Skip to content

Commit b88eb6e

Browse files
authored
Fix security workflow to generate reports locally instead of uploading to GitHub Security (#1950)
- Changed security-events permission from write to read - Disabled automatic SARIF upload in CodeQL analysis - Removed Trivy SARIF upload step that was causing permission errors - Added artifact uploads for all security scan results (CodeQL, Trivy secrets, SBOM) - Reports are now available for download as workflow artifacts for local review
1 parent 9ab4880 commit b88eb6e

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

.github/workflows/security.yaml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
permissions:
1313
actions: read
1414
contents: read
15-
security-events: write
15+
security-events: read
1616

1717
jobs:
1818
codeql:
@@ -42,6 +42,16 @@ jobs:
4242
uses: github/codeql-action/analyze@v3
4343
with:
4444
category: "/language:${{matrix.language}}"
45+
upload: false
46+
47+
- name: Upload CodeQL results as artifact
48+
uses: actions/upload-artifact@v4
49+
if: always()
50+
with:
51+
name: codeql-results-${{ matrix.language }}
52+
path: |
53+
**/results/**/*.sarif
54+
**/results/**/*.sarif.json
4555
4656
dependency-scan:
4757
name: Dependency Vulnerability Scan
@@ -75,6 +85,13 @@ jobs:
7585
format: spdx-json
7686
artifact-name: sbom.spdx.json
7787

88+
- name: Upload SBOM as artifact
89+
uses: actions/upload-artifact@v4
90+
if: always()
91+
with:
92+
name: sbom-results
93+
path: sbom.spdx.json
94+
7895
secrets-scan:
7996
name: Secrets Detection
8097
runs-on: ubuntu-latest
@@ -94,8 +111,10 @@ jobs:
94111
output: 'trivy-secrets-results.sarif'
95112
scanners: 'secret'
96113

97-
- name: Upload Trivy scan results to GitHub Security
98-
uses: github/codeql-action/upload-sarif@v3
114+
- name: Upload Trivy secrets results as artifact
115+
uses: actions/upload-artifact@v4
99116
if: always()
100117
with:
101-
sarif_file: 'trivy-secrets-results.sarif'
118+
name: trivy-secrets-results
119+
path: trivy-secrets-results.sarif
120+

0 commit comments

Comments
 (0)