Skip to content

Commit 43f6fb0

Browse files
arimxyerclaude
andcommitted
fix: correct SARIF fix to remove entire invalid fixes entries
Previous attempts: 1. Converting invalid artifactChanges to empty arrays [] - failed with "minimum length of 1" 2. Deleting artifactChanges field - failed with "requires property artifactChanges" Root cause: SARIF spec requires fix objects to have valid artifactChanges arrays (non-empty). Solution: Remove entire fix entries that don't have valid artifactChanges, rather than trying to fix the field. Validation: - Tested locally with gosec output - Invalid fixes (description only) → removed entirely - Valid fixes (with artifactChanges) → preserved - Results with no fixes → unchanged 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4f04062 commit 43f6fb0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jobs:
154154

155155
- name: Fix SARIF format
156156
run: |
157-
jq 'del(.runs[].results[].fixes[]? | select(has("artifactChanges") and (.artifactChanges | type != "array" or length == 0)) | .artifactChanges)' results.sarif > results-fixed.sarif
157+
jq '.runs[].results[] |= if .fixes then .fixes |= map(select(.artifactChanges and (.artifactChanges | type == "array" and length > 0))) else . end' results.sarif > results-fixed.sarif
158158
mv results-fixed.sarif results.sarif
159159
160160
- name: Upload SARIF file

.github/workflows/security-scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
3737
- name: Fix SARIF format
3838
run: |
39-
jq 'del(.runs[].results[].fixes[]? | select(has("artifactChanges") and (.artifactChanges | type != "array" or length == 0)) | .artifactChanges)' results.sarif > results-fixed.sarif
39+
jq '.runs[].results[] |= if .fixes then .fixes |= map(select(.artifactChanges and (.artifactChanges | type == "array" and length > 0))) else . end' results.sarif > results-fixed.sarif
4040
mv results-fixed.sarif results.sarif
4141
4242
- name: Verify SARIF fix

0 commit comments

Comments
 (0)