-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from richardcase/scanning
chore: add code & image scanning
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "main", "release-*" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
schedule: | ||
- cron: '45 15 * * *' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: 'ubuntu-latest' | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: go | ||
- name: Build | ||
run: | | ||
make build | ||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
with: | ||
category: "/language:go" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: trivy | ||
|
||
on: | ||
push: | ||
branches: [ "main", "release-*" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
schedule: | ||
- cron: '37 1 * * *' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
scan: | ||
permissions: | ||
contents: read | ||
security-events: write | ||
name: Scan | ||
runs-on: "ubuntu-20.04" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Build an image | ||
run: | | ||
TAG=${{ github.sha }} ARCH=amd64 make docker-build | ||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe | ||
with: | ||
image-ref: 'ghcr.io/rancher-sandbox/rancher-turtles-amd64:${{ github.sha }}' | ||
format: 'sarif' | ||
output: 'trivy-results.sarif' | ||
severity: 'CRITICAL,HIGH' | ||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: 'trivy-results.sarif' |