forked from DefectDojo/django-DefectDojo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new notifications type: SLA breach combined (per product)
This commit introduces a new type of notifications: SLA breach combined. The main difference is that notification is produced per product. Original SLA breach notifications are generated for each applicable findings. This may result in hundreds of messages (e-mail, slack or teams messages) for large products. Such alerts are hardly manageable and in the end not of much use. With SLA breach combined notifications being enabled a user receives a message per product with a list of findings which breach their SLA. It can be summarized in the following manner: subject: <SLA breach kind> <product type> <product> body: <product summary> <list of findings>
- Loading branch information
Showing
6 changed files
with
189 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
dojo/db_migrations/0191_notifications_sla_breach_combined.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 4.1.10 on 2023-09-12 11:29 | ||
|
||
from django.db import migrations | ||
import multiselectfield.db.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('dojo', '0190_system_settings_experimental_fp_history'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='notifications', | ||
name='sla_breach_combined', | ||
field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[('slack', 'slack'), ('msteams', 'msteams'), ('mail', 'mail'), ('alert', 'alert')], default=('alert', 'alert'), help_text='Get notified of (upcoming) SLA breaches (a message per project)', max_length=24, verbose_name='SLA breach (combined)'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{% load i18n %} | ||
{% load navigation_tags %} | ||
{% load display_tags %} | ||
<html> | ||
<body> | ||
{% autoescape on %} | ||
<p>{% trans "Hello" %} {{ user.get_full_name }},</p> | ||
<p> | ||
{% trans "Product summary" %}: | ||
<ul> | ||
<li>{% trans "name" %}: {{ product.name }}</li> | ||
<li>{% trans "product type" %}: {{ product.prod_type }}</li> | ||
<li>{% trans "team manager" %}: {{ product.team_manager }}</li> | ||
<li>{% trans "product manager" %}: {{ product.product_manager }}</li> | ||
<li>{% trans "technical contact" %}: {{ product.technical_contact }}</li> | ||
</ul> | ||
</p> | ||
<p> | ||
{% if breach_kind == 'breached' %} | ||
{% blocktranslate trimmed %} | ||
These security findings have breached their SLA: | ||
{% endblocktranslate %} | ||
{% elif breach_kind == 'prebreach' %} | ||
{% blocktranslate trimmed %} | ||
These security findings are about to breach their SLA: | ||
{% endblocktranslate %} | ||
{% elif breach_kind == 'breaching' %} | ||
{% blocktranslate trimmed %} | ||
These security findings breaching their SLA today: | ||
{% endblocktranslate %} | ||
{% else %} | ||
This should not happen, check 'breach_kind' and 'kind' properties value in the source code. | ||
{% endif %} | ||
<br /> | ||
<ul> | ||
{% for f in findings %} | ||
{% url 'view_finding' f.id as finding_url %} | ||
<li> | ||
<a href="{{ finding_url|full_url }}">"{{ f.title }}"</a> ({{ f.severity }} {% trans "severity" %}), {% trans "SLA age" %}: {{ f.sla_age }} | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
<br /> | ||
{% trans "Please refer to your SLA documentation for further guidance" %} | ||
</p> | ||
{% trans "Kind regards" %}, | ||
</br> | ||
{% if system_settings.team_name %} | ||
{{ system_settings.team_name }} | ||
{% else %} | ||
Defect Dojo | ||
{% endif %} | ||
<br /> | ||
<p> | ||
{% url 'notifications' as notification_url %} | ||
{% trans "You can manage your notification settings here" %}: <a href="{{ notification_url|full_url }}">{{ notification_url|full_url }}</a> | ||
</p> | ||
{% if system_settings.disclaimer and system_settings.disclaimer.strip %} | ||
<br /> | ||
<div style="background-color:#DADCE2; border:1px #003333; padding:.8em; "> | ||
<span style="font-size:16pt; | ||
font-family: 'Cambria','times new roman','garamond',serif; | ||
color:#ff0000">{% trans "Disclaimer" %}</span> | ||
<br /> | ||
<p style="font-size:11pt; | ||
line-height:10pt; | ||
font-family: 'Cambria','times roman',serif">{{ system_settings.disclaimer }}</p> | ||
</div> | ||
{% endif %} | ||
{% endautoescape %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters