workflows: bump actions/upload-pages-artifact from 3 to 4 #16
This file contains hidden or 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: Security Scanning | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
schedule: | |
- cron: '0 6 * * 1' # Weekly on Monday at 6 AM UTC | |
permissions: | |
contents: read | |
security-events: write | |
actions: read | |
jobs: | |
# Dependency vulnerabilities | |
dependency-scan: | |
name: Dependency Vulnerability Scan | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Set up Go | |
uses: actions/setup-go@v6 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- name: Run govulncheck | |
uses: golang/govulncheck-action@v1 | |
with: | |
go-version-file: go.mod | |
check-latest: false | |
- name: Run OSV Scanner (dependency vulnerability scanner) | |
run: | | |
go install github.com/google/osv-scanner/cmd/osv-scanner@latest | |
osv-scanner --recursive --skip-git --format=sarif --output=osv-results.sarif ./ | |
continue-on-error: true # Don't fail the job on vulnerabilities, just report them | |
- name: Upload OSV scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
if: always() | |
with: | |
sarif_file: 'osv-results.sarif' | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@0.27.0 | |
with: | |
scan-type: 'fs' | |
scan-ref: '.' | |
format: 'sarif' | |
output: 'trivy-fs-results.sarif' | |
severity: 'CRITICAL,HIGH' | |
continue-on-error: true # Don't fail the job on vulnerabilities, just report them | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
if: always() | |
with: | |
sarif_file: 'trivy-fs-results.sarif' | |
# Container security (if using Docker) | |
container-scan: | |
name: Container Security Scan | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Build test container | |
run: | | |
cat > Dockerfile.test << 'EOF' | |
FROM golang:1.23-alpine AS builder | |
WORKDIR /app | |
COPY go.mod go.sum ./ | |
RUN go mod download | |
COPY . . | |
RUN CGO_ENABLED=0 go build -o terraform-provider-wallix-bastion | |
FROM alpine:latest | |
RUN apk --no-cache add ca-certificates | |
WORKDIR /root/ | |
COPY --from=builder /app/terraform-provider-wallix-bastion . | |
CMD ["./terraform-provider-wallix-bastion"] | |
EOF | |
docker build -f Dockerfile.test -t wallix-bastion-provider:test . | |
continue-on-error: false | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@0.27.0 | |
with: | |
image-ref: 'wallix-bastion-provider:test' | |
format: 'sarif' | |
output: 'trivy-container-results.sarif' | |
severity: 'CRITICAL,HIGH' | |
continue-on-error: true | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
if: always() | |
with: | |
sarif_file: 'trivy-container-results.sarif' |