[UPD] added step with latest tag; #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci-security-scanner-checks | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
branches: | |
- main | |
schedule: | |
- cron: "0 0 * * *" | |
permissions: | |
contents: read | |
jobs: | |
trivy_scan: | |
name: trivy-scans | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
security-events: write | |
actions: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
scan-type: 'fs' | |
scan-ref: '.' | |
format: 'sarif' | |
severity: 'CRITICAL,HIGH' | |
output: 'trivy-results.sarif' | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: 'trivy-results.sarif' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
snyk_scan: | |
name: snyk-scans | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
security-events: write | |
actions: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: snyk/actions/setup@master | |
- name: Get Go Version | |
run: | | |
#!/bin/bash | |
GOVERSION=$({ [ -f .go-version ] && cat .go-version; }) | |
echo "GOVERSION=$GOVERSION" >> $GITHUB_ENV | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GOVERSION }} | |
- name: Run Snyk to check for vulnerabilities | |
uses: snyk/actions/golang@master | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_AUTH_TOKEN }} | |
with: | |
args: --sarif-file-output=snyk-results.sarif | |
- name: Upload result to GitHub Code Scanning | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: 'snyk-results.sarif' | |
nancy_check: | |
name: nancy-check | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
security-events: write | |
actions: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get Go Version | |
run: | | |
#!/bin/bash | |
GOVERSION=$({ [ -f .go-version ] && cat .go-version; }) | |
echo "GOVERSION=$GOVERSION" >> $GITHUB_ENV | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GOVERSION }} | |
- name: WriteGoList | |
run: go list -json -m all > go.list | |
- name: Nancy | |
uses: sonatype-nexus-community/nancy-github-action@main | |
with: | |
nancyVersion: "v1.0.46" | |
nancyCommand: sleuth --loud |