Skip to content

Commit a35ee1d

Browse files
Fix: Suppress expected JIRA validation alerts when pushing (Fixes DefectDojo#12988) (DefectDojo#13974)
* Fix: Suppress expected JIRA validation alerts when auto-pushing Fixes DefectDojo#12988 When 'Push all issues' is enabled at the engagement level, DefectDojo attempts to automatically push all findings to JIRA during import/reimport. This causes alerts to be created for every finding that cannot be pushed due to expected validation failures (e.g., not verified, not active, below minimum threshold). These alerts flood the Alerts UI with noise since these are expected conditions, not actual errors. The fix distinguishes between: - Expected validation failures: Findings that aren't ready to be pushed (not verified/active, below threshold, etc.) - these are logged but don't create alerts - Unexpected errors: Configuration issues, connection problems, etc. - these still create alerts as they indicate real problems This ensures users only see alerts for actual problems while still logging expected validation failures for debugging purposes. * fix * Update dojo/jira_link/helper.py Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com> --------- Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com>
1 parent 8669a4b commit a35ee1d

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

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.")

0 commit comments

Comments
 (0)