-
Notifications
You must be signed in to change notification settings - Fork 2
chore: integrate snyk security scanning via GitHub Actions #126
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: Snyk Security Scan | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| snyk: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| env: | ||
| SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
| steps: | ||
| - name: Harden the runner (Audit all outbound calls) | ||
| uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0 | ||
| with: | ||
| egress-policy: audit | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Setup Node.js | ||
| if: hashFiles('package.json') != '' | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: 20 | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| if: hashFiles('package.json') != '' | ||
| run: npm ci | ||
|
|
||
| - name: Setup Snyk | ||
| if: env.SNYK_TOKEN != '' | ||
| uses: snyk/actions/setup@b98263eb70355f69f2e718b56d354966d5b08c9f # v3 | ||
|
|
||
| - name: Run Snyk test | ||
| if: env.SNYK_TOKEN != '' | ||
| run: snyk test --severity-threshold=high | ||
| continue-on-error: true | ||
|
|
||
|
Comment on lines
+41
to
+45
|
||
| - name: Snyk monitor | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' && env.SNYK_TOKEN != '' | ||
| run: snyk monitor | ||
| continue-on-error: true | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All other workflows add a "Harden the runner" step via step-security/harden-runner (e.g., .github/workflows/codeql.yml:42-46), but this workflow does not. Consider adding the same hardening step (and egress policy) here to keep runner security consistent across CI workflows.