Skip to content

Commit

Permalink
Merge pull request #222 from richardcase/scanning
Browse files Browse the repository at this point in the history
chore: add code &  image scanning
  • Loading branch information
richardcase authored Oct 20, 2023
2 parents 702d1b7 + 30e53b9 commit 15c1a00
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/codeql.yml
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"
37 changes: 37 additions & 0 deletions .github/workflows/trivy.yml
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'

0 comments on commit 15c1a00

Please sign in to comment.