Skip to content

Commit

Permalink
feat(security): add snyk scan
Browse files Browse the repository at this point in the history
  • Loading branch information
KatoakDR committed Oct 16, 2023
1 parent 1c9356a commit d031816
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Checkout source
uses: actions/checkout@v3

- name: Setup node
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Setup node
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Use Snyk to find and fix vulnerabilities in your GitHub repository.
# https:/snyk/actions/

name: Snyk Security

on:
# Scan every Sunday at 1am
schedule:
- cron: '0 1 * * SUN'
# Scan every push to main branch
push:
branches:
- main
# Scan every pull request to main branch
pull_request:
branches:
- main

permissions:
contents: read

jobs:
snyk:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status

runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: yarn
cache-dependency-path: yarn.lock

- name: Install dependencies
run: yarn install

- name: Setup Snyk
uses: snyk/actions/setup@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Snyk Code Scan
run: snyk code test --sarif > snyk-code.sarif
continue-on-error: true # so that the SARIF upload gets called
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Snyk Open Source Monitor
run: snyk monitor --all-projects
continue-on-error: true # so that the SARIF upload gets called
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Upload results to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: snyk-code.sarif
category: Snyk
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Checkout source
uses: actions/checkout@v3

- name: Setup node
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
Expand Down

0 comments on commit d031816

Please sign in to comment.