Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add SARIF upload to GitHub Security Dashboard #2929

Merged
merged 6 commits into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,26 @@ jobs:
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
container:
image: semgrep/semgrep
image: ghcr.io/zeta-chain/semgrep-semgrep:1.90.0

if: (github.actor != 'dependabot[bot]')
steps:
- uses: actions/checkout@v4
- run: semgrep ci
- uses: actions/checkout@v4
- name: Checkout semgrep-utilities repo
uses: actions/checkout@v4
with:
repository: zeta-chain/semgrep-utilities
path: semgrep-utilities

# uses json for semgrep script for transformation in the next step
- run: semgrep ci --json --output semgrep-findings.json
lumtis marked this conversation as resolved.
Show resolved Hide resolved

# transforms the the output from the above into a GHAS compatible SARIF
# SARIF output by "semgrep --sarif" doesn't integrate well with GHAS dashboard
# Example: the event name uses segmrep rules name/ID, severities are [error, warning, info], tags are a bit confusing)
- run: python semgrep-utilities/utilities/github-sarif-helper/src/semgrep-json-to-sarif.py --json semgrep-findings.json --sarif semgrep-github.sarif
lumtis marked this conversation as resolved.
Show resolved Hide resolved

- name: Upload SARIF file for GitHub Advanced Security Dashboard
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: semgrep-github.sarif
Loading