Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ If you want to apply RBAC\-based filtering to your Slack messages, enabling pers

If your team has a Slack integration enabled (through the above process), individual users can also configure notifications to send directly to your personal Slackbot channel.

1. Start by navigating to your personal Profile page on DefectDojo. Find this by clicking the 👤 **icon** in the top\-right corner. Select your DefectDojo Username from the list. (👤 **paul** in our example)
1. Start by navigating to your personal Profile page on DefectDojo. Find this by clicking the 👤 **icon** in the top\-right corner. Select your DefectDojo Username from the list. (👤 **paul** in our example)
![image](images/Configure_a_Slack_Integration_4.png)

Expand All @@ -111,14 +111,16 @@ You can now [set specific notifications](../about_notifications/) to be sent to

Microsoft Teams can receive notifications to a specific channel. To do this, you will need to **set up an incoming webhook** on the channel where you wish to receive messages.

1. Complete the process listed in the **[Microsoft Teams Documentation](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=dotnet)** for creating a new Incoming Webhook. Keep your unique webhook.office.com link handy as you will need it in subsequent steps.
Please note that the old [Office Connector webhooks](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=newteams%2Cdotnet) will be retired by Microsoft, use a new Power Automate Workflow based webhook as documented below.

1. Complete the process listed in the **[Microsoft Teams Documentation](https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498)** for creating a new Incoming Webhook. Keep your unique logic.azure.com link handy as you will need it in subsequent steps. You can create webhook for a channel or for a specific chat.
![image](images/Configure_a_Microsoft_Teams_Integration.png)
2. In DefectDojo, navigate to **Configuration \> System Settings** from the sidebar. (In the Pro UI, this form is located under **Enterprise Settings > System Settings**.)
3. Check the **Enable Microsoft Teams notifications** box. This will open a hidden section of the form, labeled **‘Msteams url**’.
3. Check the **Enable Microsoft Teams notifications** box. This will open a hidden section of the form, labeled **‘Msteams url**’.
![image](images/Configure_a_Microsoft_Teams_Integration_2.png)
4. Paste the webhook.office.com URL (created in Step 1\) in the **Msteams url** box. Your Teams app will now listen to incoming Notifications from DefectDojo and post them to the channel you selected.
4. Paste the logic.azure.com URL (created in Step 1\) in the **Msteams url** box. Your Teams app will now listen to incoming Notifications from DefectDojo and post them to the channel you selected.

### Notes on the Teams integration

Expand Down
3 changes: 2 additions & 1 deletion dojo/notifications/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,10 @@ def send_msteams_notification(
"msteams",
kwargs,
),
headers={"Content-Type": "application/json"},
timeout=settings.REQUESTS_TIMEOUT,
)
if res.status_code != 200:
if not (200 <= res.status_code < 300):
logger.error("Error when sending message to Microsoft Teams")
logger.error(res.status_code)
logger.error(res.text)
Expand Down
3 changes: 0 additions & 3 deletions dojo/templates/notifications/alert/report_created.tpl

This file was deleted.

2 changes: 1 addition & 1 deletion dojo/templates/notifications/alert/scan_added_empty.tpl
37 changes: 0 additions & 37 deletions dojo/templates/notifications/mail/report_created.tpl

This file was deleted.

2 changes: 1 addition & 1 deletion dojo/templates/notifications/mail/scan_added_empty.tpl
137 changes: 98 additions & 39 deletions dojo/templates/notifications/msteams/engagement_added.tpl
Original file line number Diff line number Diff line change
@@ -1,44 +1,103 @@
{% load i18n %}
{% load display_tags %}
{% load i18n %}{% load display_tags %}{% url 'view_engagement' engagement.id as url %}
{
"@context": "https://schema.org/extensions",
"@type": "MessageCard",
"title": "{% trans "Engagement added" %}",
"summary": "{% trans "Engagement added" %}",
"sections": [
"type": "message",
"attachments": [
{
"activityTitle": "DefectDojo",
"activityImage": "https://raw.githubusercontent.com/DefectDojo/django-DefectDojo/master/dojo/static/dojo/img/chop.png",
"text": "{% trans "A new engagement has been added" %}.",
"facts": [
{
"name": "{% trans "Product" %}:",
"value": "{{ engagement.product.name }}"
},
{
"name": "{% trans "Engagement" %}:",
"value": "{{ engagement.name }}"
}
]
}
{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %}
,{
"activityTitle": "{% trans "Disclaimer" %}",
"text": "{{ system_settings.disclaimer_notifications }}"
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "Image",
"url": "https://raw.githubusercontent.com/DefectDojo/django-DefectDojo/master/dojo/static/dojo/img/chop.png",
"size": "Small"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "DefectDojo",
"weight": "Bolder",
"size": "Medium"
},
{
"type": "TextBlock",
"text": "{% trans 'Engagement Added' %}",
"weight": "Bolder",
"size": "Large",
"color": "Accent"
}
]
}
]
},
{
"type": "TextBlock",
"text": "{% trans 'A new engagement' %} [{{ engagement.name }}]({{ url|full_url }}) {% trans 'has been added.' %}",
"wrap": true,
"spacing": "Medium"
},
{
"type": "FactSet",
"facts": [
{
"title": "{% trans 'Product' %}:",
"value": "{{ engagement.product.name }}"
},
{
"title": "{% trans 'Engagement' %}:",
"value": "{{ engagement.name }}"
},
{
"title": "{% trans 'Start date' %}:",
"value": "{{ engagement.target_start }}"
},
{
"title": "{% trans 'End date' %}:",
"value": "{{ engagement.target_end }}"
}
],
"spacing": "Medium"
}{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %},
{
"type": "Container",
"style": "attention",
"items": [
{
"type": "TextBlock",
"text": "{% trans 'Disclaimer' %}",
"weight": "Bolder"
},
{
"type": "TextBlock",
"text": "{{ system_settings.disclaimer_notifications }}",
"wrap": true
}
],
"spacing": "Medium"
}{% endif %}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "{% trans 'View Engagement' %}",
"url": "{{ url|full_url }}"
}
]
}
{% endif %}

],
"potentialAction": [
{
"@type": "OpenUri",
"name": "{% trans "View Engagement" %}",
"targets": [
{
"os": "default",
"uri": "{{ url|full_url }}"
}
]
}
]
}
}
135 changes: 97 additions & 38 deletions dojo/templates/notifications/msteams/engagement_closed.tpl
Original file line number Diff line number Diff line change
@@ -1,44 +1,103 @@
{% load i18n %}
{% load display_tags %}
{% load i18n %}{% load display_tags %}{% url 'view_engagement' engagement.id as url %}
{
"@context": "https://schema.org/extensions",
"@type": "MessageCard",
"title": "{% trans "Engagement closed" %}",
"summary": "{% trans "Engagement closed" %}",
"sections": [
"type": "message",
"attachments": [
{
"activityTitle": "DefectDojo",
"activityImage": "https://raw.githubusercontent.com/DefectDojo/django-DefectDojo/master/dojo/static/dojo/img/chop.png",
"text": "{% trans "An engagement has been closed" %}.",
"facts": [
{
"name": "{% trans "Product" %}:",
"value": "{{ engagement.product.name }}"
},
{
"name": "{% trans "Engagement" %}:",
"value": "{{ engagement.name }}"
}
]
}
{% if system_settings.disclaimer and system_settings.disclaimer.strip %}
,{
"activityTitle": "{% trans "Disclaimer" %}",
"text": "{{ system_settings.disclaimer }}"
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "Image",
"url": "https://raw.githubusercontent.com/DefectDojo/django-DefectDojo/master/dojo/static/dojo/img/chop.png",
"size": "Small"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "DefectDojo",
"weight": "Bolder",
"size": "Medium"
},
{
"type": "TextBlock",
"text": "{% trans 'Engagement Closed' %}",
"weight": "Bolder",
"size": "Large",
"color": "Accent"
}
]
}
]
},
{
"type": "TextBlock",
"text": "{% trans 'An engagement' %} [{{ engagement.name }}]({{ url|full_url }}) {% trans 'has been closed.' %}",
"wrap": true,
"spacing": "Medium"
},
{
"type": "FactSet",
"facts": [
{
"title": "{% trans 'Product' %}:",
"value": "{{ engagement.product.name }}"
},
{
"title": "{% trans 'Engagement' %}:",
"value": "{{ engagement.name }}"
},
{
"title": "{% trans 'Start date' %}:",
"value": "{{ engagement.target_start }}"
},
{
"title": "{% trans 'End date' %}:",
"value": "{{ engagement.target_end }}"
}
],
"spacing": "Medium"
}{% if system_settings.disclaimer_notifications and system_settings.disclaimer_notifications.strip %},
{
"type": "Container",
"style": "attention",
"items": [
{
"type": "TextBlock",
"text": "{% trans 'Disclaimer' %}",
"weight": "Bolder"
},
{
"type": "TextBlock",
"text": "{{ system_settings.disclaimer_notifications }}",
"wrap": true
}
],
"spacing": "Medium"
}{% endif %}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "{% trans 'View Engagement' %}",
"url": "{{ url|full_url }}"
}
]
}
{% endif %}

],
"potentialAction": [
{
"@type": "OpenUri",
"name": "{% trans "View Engagement" %}",
"targets": [
{
"os": "default",
"uri": "{{ url|full_url }}"
}
]
}
]
}
Loading