Skip to content

Commit 3d8b577

Browse files
Merge branch 'bugfix' into Maffooch-patch-1
2 parents 0372240 + 1363dd3 commit 3d8b577

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

docs/content/en/open_source/upgrading/2.52.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ There are other instructions for upgrading to 2.52.x. Check the [Release Notes](
9090

9191
## Merge of MobSF parsers
9292

93-
Mobsfscan Scan" has been merged into the "MobSF Scan" parser. The "Mobsfscan Scan" scan_type has been retained to keep deduplication working for existing Tests, but users are encouraged to move to the "MobSF Scan" scan_type.
93+
"Mobsfscan Scan" has been merged into the "MobSF Scan" parser. The "Mobsfscan Scan" scan_type has been retained to keep deduplication working for existing Tests, but users are encouraged to move to the "MobSF Scan" scan_type.
9494

9595
## Release notes
9696
Check the [Release Notes](https://github.com/DefectDojo/django-DefectDojo/releases/tag/2.52.0) for the contents of the release.

dojo/jira_link/helper.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,13 +906,30 @@ def failure_to_add_message(message: str, exception: Exception, _: Any) -> bool:
906906
message = f"Object {obj.id} cannot be pushed to JIRA as the JIRA instance has been deleted or is not available."
907907
return failure_to_add_message(message, None, obj)
908908

909-
obj_can_be_pushed_to_jira, error_message, _error_code = can_be_pushed_to_jira(obj)
909+
obj_can_be_pushed_to_jira, error_message, error_code = can_be_pushed_to_jira(obj)
910910
if not obj_can_be_pushed_to_jira:
911+
# Expected validation failures (not verified, not active, below threshold)
912+
# should not create alerts when auto-pushing via "push all issues"
913+
# These are expected conditions that don't indicate a problem
914+
expected_validation_errors = [
915+
"error_not_active_or_verified",
916+
"error_below_minimum_threshold",
917+
"error_empty",
918+
"error_inactive",
919+
]
920+
911921
# not sure why this check is not part of can_be_pushed_to_jira, but afraid to change it
912922
if isinstance(obj, Finding) and obj.duplicate and not obj.active:
913-
logger.warning("%s will not be pushed to JIRA as it's a duplicate finding", to_str_typed(obj))
914-
log_jira_cannot_be_pushed_reason(error_message + " and findis a duplicate", obj)
923+
logger.info("%s will not be pushed to JIRA as it's a duplicate finding", to_str_typed(obj))
924+
# Duplicates are expected, don't create alerts
925+
logger.info("%s cannot be pushed to JIRA: %s (expected - duplicate finding)",
926+
to_str_typed(obj), error_message)
927+
elif error_code in expected_validation_errors:
928+
# These are expected when auto-pushing, only log, don't alert
929+
logger.info("%s cannot be pushed to JIRA: %s (expected - finding not ready yet)",
930+
to_str_typed(obj), error_message)
915931
else:
932+
# Unexpected errors (configuration issues, etc.) should still alert
916933
log_jira_cannot_be_pushed_reason(error_message, obj)
917934
logger.warning("%s cannot be pushed to JIRA: %s.", to_str_typed(obj), error_message)
918935
logger.warning("The JIRA issue will NOT be created.")

dojo/jira_link/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,9 @@ def check_for_and_create_comment(parsed_json):
287287
finding.jira_issue.save()
288288
finding.last_reviewed = new_note.date
289289
finding.last_reviewed_by = author
290-
finding.save(update_fields=["last_reviewed", "last_reviewed_by"])
290+
# Only update the timestamp fields, not other fields like 'active' to avoid
291+
# race conditions with concurrent webhook events (e.g. issue_updated)
292+
finding.save(update_fields=["last_reviewed", "last_reviewed_by", "updated"])
291293
return None
292294

293295

0 commit comments

Comments
 (0)