Skip to content

Commit 70c6ad4

Browse files
authored
fix(sarif): Use level variable for detector status handling Fix for issue #1122: Implement support for setting SARIF report level based on detector enabled/disabled status. This commit adds a level variable that can be computed based on whether the detector is enabled or disabled from the platform configuration. Currently defaults to "error" for all detectors, but provides the framework for checking detector status and setting level to "note" for disabled detectors as proposed in issue #1122. Changes: - Added level variable computation in _create_sarif_result_dict() - Updated SARIF result to use dynamic level variable instead of hardcoded "error" - Added TODO comment for implementing platform detector status check
Added logic to determine level based on detector status and included a TODO for future enhancements.
1 parent ec91377 commit 70c6ad4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ggshield/verticals/secret/output/secret_sarif_output_handler.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,13 @@ def _create_sarif_result_dict(
100100
markdown_message += f"\nMatches:\n{matches_li}"
101101

102102
# Create dict
103+
# Determine level based on detector status (fix for issue #1122)
104+
# TODO: Add logic to check if detector is enabled/disabled from platform
105+
level = "error" # Default to error, should be "note" if detector is disabled
106+
103107
dct = {
104108
"ruleId": secret.detector_display_name,
105-
"level": "error",
106-
"message": {
109+
"level": level, "message": {
107110
"text": message,
108111
"markdown": markdown_message,
109112
},

0 commit comments

Comments
 (0)