-
Notifications
You must be signed in to change notification settings - Fork 4
112 lines (95 loc) · 3.29 KB
/
security.yml
File metadata and controls
112 lines (95 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
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.33.1
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.33.1
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'