Skip to content

Commit 81a0ca7

Browse files
authored
Merge pull request #11807 from DefectDojo/master-into-dev/2.43.2-2.44.0-dev
Release: Merge back 2.43.2 into dev from: master-into-dev/2.43.2-2.44.0-dev
2 parents 2835b2e + 7f1d8bc commit 81a0ca7

File tree

11 files changed

+98
-70
lines changed

11 files changed

+98
-70
lines changed

dojo/finding/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,7 +2983,7 @@ def finding_bulk_update_all(request, pid=None):
29832983
) = jira_helper.can_be_pushed_to_jira(group)
29842984
if not can_be_pushed_to_jira:
29852985
error_counts[error_message] += 1
2986-
jira_helper.log_jira_alert(error_message, group)
2986+
jira_helper.log_jira_cannot_be_pushed_reason(error_message, group)
29872987
else:
29882988
logger.debug(
29892989
"pushing to jira from finding.finding_bulk_update_all()",
@@ -3033,10 +3033,10 @@ def finding_bulk_update_all(request, pid=None):
30333033
"finding already pushed as part of Finding Group"
30343034
)
30353035
error_counts[error_message] += 1
3036-
jira_helper.log_jira_alert(error_message, finding)
3036+
jira_helper.log_jira_cannot_be_pushed_reason(error_message, finding)
30373037
elif not can_be_pushed_to_jira:
30383038
error_counts[error_message] += 1
3039-
jira_helper.log_jira_alert(error_message, finding)
3039+
jira_helper.log_jira_cannot_be_pushed_reason(error_message, finding)
30403040
else:
30413041
logger.debug(
30423042
"pushing to jira from finding.finding_bulk_update_all()",

dojo/jira_link/helper.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,8 @@ def get_jira_comments(finding):
514514
return None
515515

516516

517-
# Logs the error to the alerts table, which appears in the notification toolbar
518517
def log_jira_generic_alert(title, description):
518+
"""Creates a notification for JIRA errors happening outside the scope of a specific (finding/group/epic) object"""
519519
create_notification(
520520
event="jira_update",
521521
title=title,
@@ -524,8 +524,8 @@ def log_jira_generic_alert(title, description):
524524
source="JIRA")
525525

526526

527-
# Logs the error to the alerts table, which appears in the notification toolbar
528527
def log_jira_alert(error, obj):
528+
"""Creates a notification for JIRA errors when handling a specific (finding/group/epic) object"""
529529
create_notification(
530530
event="jira_update",
531531
title="Error pushing to JIRA " + "(" + truncate_with_dots(prod_name(obj), 25) + ")",
@@ -536,6 +536,19 @@ def log_jira_alert(error, obj):
536536
obj=obj)
537537

538538

539+
def log_jira_cannot_be_pushed_reason(error, obj):
540+
"""Creates an Alert for GUI display when handling a specific (finding/group/epic) object"""
541+
create_notification(
542+
event="jira_update",
543+
title="Error pushing to JIRA " + "(" + truncate_with_dots(prod_name(obj), 25) + ")",
544+
description=obj.__class__.__name__ + ": " + error,
545+
url=obj.get_absolute_url(),
546+
icon="bullseye",
547+
source="Push to JIRA",
548+
obj=obj,
549+
alert_only=True)
550+
551+
539552
# Displays an alert for Jira notifications
540553
def log_jira_message(text, finding):
541554
create_notification(
@@ -787,10 +800,12 @@ def failure_to_add_message(message: str, exception: Exception, _: Any) -> bool:
787800

788801
obj_can_be_pushed_to_jira, error_message, _error_code = can_be_pushed_to_jira(obj)
789802
if not obj_can_be_pushed_to_jira:
803+
# not sure why this check is not part of can_be_pushed_to_jira, but afraid to change it
790804
if isinstance(obj, Finding) and obj.duplicate and not obj.active:
791805
logger.warning("%s will not be pushed to JIRA as it's a duplicate finding", to_str_typed(obj))
806+
log_jira_cannot_be_pushed_reason(error_message + " and findis a duplicate", obj)
792807
else:
793-
log_jira_alert(error_message, obj)
808+
log_jira_cannot_be_pushed_reason(error_message, obj)
794809
logger.warning("%s cannot be pushed to JIRA: %s.", to_str_typed(obj), error_message)
795810
logger.warning("The JIRA issue will NOT be created.")
796811
return False

dojo/notifications/helper.py

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def create_notification(
5454
no_users: bool = False, # noqa: FBT001, FBT002
5555
url: str | None = None,
5656
url_api: str | None = None,
57+
alert_only: bool = False, # noqa: FBT001, FBT002
5758
**kwargs: dict,
5859
) -> None:
5960
"""Create an instance of a NotificationManager and dispatch the notification."""
@@ -86,6 +87,7 @@ def create_notification(
8687
no_users=no_users,
8788
url=url,
8889
url_api=url_api,
90+
alert_only=alert_only,
8991
**kwargs,
9092
)
9193

@@ -802,61 +804,68 @@ def _process_notifications(
802804
)
803805
logger.debug("process notifications for %s", notifications.user)
804806

805-
if self.system_settings.enable_slack_notifications and "slack" in getattr(
806-
notifications,
807-
event,
808-
getattr(notifications, "other"),
809-
):
810-
logger.debug("Sending Slack Notification")
811-
self._get_manager_instance("slack").send_slack_notification(
807+
alert_only = kwargs.get("alert_only", False)
808+
if alert_only:
809+
logger.debug("sending alert only")
810+
811+
if "alert" in getattr(notifications, event, getattr(notifications, "other")):
812+
logger.debug(f"Sending Alert to {notifications.user}")
813+
self._get_manager_instance("alert").send_alert_notification(
812814
event,
813815
user=notifications.user,
814816
**kwargs,
815817
)
816818

817-
if self.system_settings.enable_msteams_notifications and "msteams" in getattr(
818-
notifications,
819-
event,
820-
getattr(notifications, "other"),
821-
):
822-
logger.debug("Sending MSTeams Notification")
823-
self._get_manager_instance("msteams").send_msteams_notification(
819+
# Some errors should not be pushed to all channels, only to alerts.
820+
# For example reasons why JIRA Issues: https://github.com/DefectDojo/django-DefectDojo/issues/11575
821+
if not alert_only:
822+
if self.system_settings.enable_slack_notifications and "slack" in getattr(
823+
notifications,
824824
event,
825-
user=notifications.user,
826-
**kwargs,
827-
)
825+
getattr(notifications, "other"),
826+
):
827+
logger.debug("Sending Slack Notification")
828+
self._get_manager_instance("slack").send_slack_notification(
829+
event,
830+
user=notifications.user,
831+
**kwargs,
832+
)
828833

829-
if self.system_settings.enable_mail_notifications and "mail" in getattr(
830-
notifications,
831-
event,
832-
getattr(notifications, "other"),
833-
):
834-
logger.debug("Sending Mail Notification")
835-
self._get_manager_instance("mail").send_mail_notification(
834+
if self.system_settings.enable_msteams_notifications and "msteams" in getattr(
835+
notifications,
836836
event,
837-
user=notifications.user,
838-
**kwargs,
839-
)
837+
getattr(notifications, "other"),
838+
):
839+
logger.debug("Sending MSTeams Notification")
840+
self._get_manager_instance("msteams").send_msteams_notification(
841+
event,
842+
user=notifications.user,
843+
**kwargs,
844+
)
840845

841-
if self.system_settings.enable_webhooks_notifications and "webhooks" in getattr(
842-
notifications,
843-
event,
844-
getattr(notifications, "other"),
845-
):
846-
logger.debug("Sending Webhooks Notification")
847-
self._get_manager_instance("webhooks").send_webhooks_notification(
846+
if self.system_settings.enable_mail_notifications and "mail" in getattr(
847+
notifications,
848848
event,
849-
user=notifications.user,
850-
**kwargs,
851-
)
849+
getattr(notifications, "other"),
850+
):
851+
logger.debug("Sending Mail Notification")
852+
self._get_manager_instance("mail").send_mail_notification(
853+
event,
854+
user=notifications.user,
855+
**kwargs,
856+
)
852857

853-
if "alert" in getattr(notifications, event, getattr(notifications, "other")):
854-
logger.debug(f"Sending Alert to {notifications.user}")
855-
self._get_manager_instance("alert").send_alert_notification(
858+
if self.system_settings.enable_webhooks_notifications and "webhooks" in getattr(
859+
notifications,
856860
event,
857-
user=notifications.user,
858-
**kwargs,
859-
)
861+
getattr(notifications, "other"),
862+
):
863+
logger.debug("Sending Webhooks Notification")
864+
self._get_manager_instance("webhooks").send_webhooks_notification(
865+
event,
866+
user=notifications.user,
867+
**kwargs,
868+
)
860869

861870

862871
@app.task(ignore_result=True)

dojo/settings/settings.dist.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,6 +1773,7 @@ def saml2_attrib_map_format(din):
17731773
"KHV": "https://avd.aquasec.com/misconfig/kubernetes/", # e.g. https://avd.aquasec.com/misconfig/kubernetes/khv045
17741774
"MGASA-": "https://advisories.mageia.org/&&.html", # e.g. https://advisories.mageia.org/MGASA-2025-0023.html
17751775
"OSV-": "https://osv.dev/vulnerability/", # e.g. https://osv.dev/vulnerability/OSV-2024-1330
1776+
"PMASA-": "https://www.phpmyadmin.net/security/", # e.g. https://www.phpmyadmin.net/security/PMASA-2025-1
17761777
"PYSEC-": "https://osv.dev/vulnerability/", # e.g. https://osv.dev/vulnerability/PYSEC-2024-48
17771778
"RHBA-": "https://access.redhat.com/errata/", # e.g. https://access.redhat.com/errata/RHBA-2024:2406
17781779
"RHEA-": "https://access.redhat.com/errata/", # e.g. https://access.redhat.com/errata/RHEA-2024:8857
@@ -1783,6 +1784,7 @@ def saml2_attrib_map_format(din):
17831784
"RXSA-": "https://errata.rockylinux.org/", # e.g. https://errata.rockylinux.org/RXSA-2024:4928
17841785
"SNYK-": "https://snyk.io/vuln/", # e.g. https://security.snyk.io/vuln/SNYK-JS-SOLANAWEB3JS-8453984
17851786
"TEMP-": "https://security-tracker.debian.org/tracker/", # e.g. https://security-tracker.debian.org/tracker/TEMP-0841856-B18BAF
1787+
"TYPO3-": "https://typo3.org/security/advisory/", # e.g. https://typo3.org/security/advisory/typo3-core-sa-2025-010
17861788
"USN-": "https://ubuntu.com/security/notices/", # e.g. https://ubuntu.com/security/notices/USN-6642-1
17871789
"VNS": "https://vulners.com/",
17881790
}

dojo/templates/base.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
{% if request.user.is_authenticated %}
160160
<li>
161161
<a href="{% url 'view_profile' %}">
162-
<i class="fa-solid fa-user fa-fw"></i>
162+
<i class="fa-solid fa-user fa-fw"></i>
163163
{{ request.user.username }}
164164
</a>
165165
</li>
@@ -438,7 +438,7 @@
438438
</a>
439439
<ul class="nav nav-second-level">
440440
{% if "auth.view_user"|has_configuration_permission:request %}
441-
<li>
441+
<li>
442442
<a href="{% url 'users' %}">
443443
{% trans "Users" %}
444444
</a>
@@ -666,7 +666,7 @@ <h3 class="no-margin-top" style="padding-bottom: 5px;">
666666
<a class="dropdown-toggle" data-toggle="dropdown" href="">
667667
<span class="fa-solid fa-calendar-days" aria-hidden="true"></span>
668668
<span class="hidden-xs">{% trans "Engagements" %}
669-
{% if product_tab.engagements > 0 %}
669+
{% if product_tab.engagements > 0 %}
670670
<span class="badge">{{ product_tab.engagements }}</span>
671671
{% endif %}
672672
</span>
@@ -1136,6 +1136,9 @@ <h3 class="no-margin-top" style="padding-bottom: 5px;">
11361136
{% endif %}
11371137

11381138
function htmlEscape(str) {
1139+
if (!str) {
1140+
return '';
1141+
}
11391142
return str
11401143
.replace(/\n/g, " ")
11411144
.replace(/&/g, '&amp;')

dojo/tools/noseyparker/parser.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,22 @@ def version_0_22_0(self, line, test):
115115
if json_path.get("first_commit"):
116116
title = f"Secret(s) Found in Repository with Commit ID {json_path['first_commit']['commit_metadata']['commit_id']}"
117117
filepath = json_path["first_commit"]["blob_path"]
118-
description = (
119-
f"Secret found of type: {rule_name} \n"
120-
f"SECRET starts with: '{rule_text_id[:3]}' \n"
121-
f"Committer Name: {json_path['first_commit']['commit_metadata']['committer_name']} \n"
122-
f"Committer Email: {json_path['first_commit']['commit_metadata']['committer_email']} \n"
123-
f"Commit ID: {json_path['first_commit']['commit_metadata']['commit_id']} \n"
124-
f"Location: {filepath} line #{line_num} \n"
125-
f"Line #{line_num} \n"
118+
description = (f"Secret found of type: {rule_name} \n"
119+
f"Rule Text ID: '{rule_text_id}' \n"
120+
f"Committer Name: {json_path['first_commit']['commit_metadata']['committer_name']} \n"
121+
f"Committer Email: {json_path['first_commit']['commit_metadata']['committer_email']} \n"
122+
f"Commit ID: {json_path['first_commit']['commit_metadata']['commit_id']} \n"
123+
f"Location: {filepath} line #{line_num} \n"
124+
f"Line #{line_num} \n"
126125
)
127126
# scanned wihout git history
128127
else:
129128
title = "Secret(s) Found in Repository"
130129
filepath = json_path["path"]
131-
description = (
132-
f"Secret found of type: {rule_name} \n"
133-
f"SECRET starts with: '{rule_text_id[:3]}' \n"
134-
f"Location: {filepath} line #{line_num} \n"
135-
f"Line #{line_num} \n"
130+
description = (f"Secret found of type: {rule_name} \n"
131+
f"Rule Text ID: '{rule_text_id}' \n"
132+
f"Location: {filepath} line #{line_num} \n"
133+
f"Line #{line_num} \n"
136134
)
137135
# Internal de-duplication
138136
key = hashlib.md5((filepath + "|" + rule_text_id + "|" + str(line_num)).encode("utf-8")).hexdigest()

helm/defectdojo/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: "2.44.0-dev"
33
description: A Helm chart for Kubernetes to install DefectDojo
44
name: defectdojo
5-
version: 1.6.173-dev
5+
version: 1.6.174-dev
66
icon: https://www.defectdojo.org/img/favicon.ico
77
maintainers:
88
- name: madchap

helm/defectdojo/templates/media-pvc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ metadata:
1010
app.kubernetes.io/instance: {{ $.Release.Name }}
1111
app.kubernetes.io/managed-by: {{ $.Release.Service }}
1212
helm.sh/chart: {{ include "defectdojo.chart" $ }}
13-
{{- with .Values.extraLabels }}
13+
{{- with $.Values.extraLabels }}
1414
{{- toYaml . | nindent 4 }}
1515
{{- end }}
1616
name: {{ $fullName }}

readme-docs/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ feedback, please let us know in the `#defectdojo` channel in [OWASP's Slack](htt
5454

5555
## Writing a New Parser
5656

57-
Please see [the parser guide](https://documentation.defectdojo.com/contributing/how-to-write-a-parser/) for guidance on how to write a parser.
57+
Please see [the parser guide](https://documentation.defectdojo.com/en/open_source/contributing/how-to-write-a-parser/) for guidance on how to write a parser.
5858

5959
## Modifying DefectDojo and Testing
6060

readme-docs/DOCKER.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,11 @@ Run a single test. Example:
306306
python manage.py test unittests.tools.test_dependency_check_parser.TestDependencyCheckParser.test_parse_file_with_no_vulnerabilities_has_no_findings --keepdb
307307
```
308308

309-
For docker compose stack, there is a convenience script (`dc-unittest.sh`) capable of running a single test class.
309+
For docker compose stack, there is a convenience script (`run-unittest.sh`) capable of running a single test class.
310310
You will need to provide a test case (`--test-case`). Example:
311311

312312
```
313-
./dc-unittest.sh --test-case unittests.tools.test_stackhawk_parser.TestStackHawkParser
313+
./run-unittest.sh --test-case unittests.tools.test_stackhawk_parser.TestStackHawkParser
314314
```
315315

316316
## Running the integration tests

0 commit comments

Comments
 (0)