-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (93 loc) · 3.59 KB
/
security.yml
File metadata and controls
111 lines (93 loc) · 3.59 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
# security.yml - Consolidated security scanning
# Last Updated: 2026-02-22
name: Security Validation
on:
pull_request:
branches: [main, develop]
push:
branches: [main]
schedule:
- cron: "0 2 * * 0"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
security-audit:
name: Security Audit
runs-on: ubuntu-latest
timeout-minutes: 35
permissions:
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Setup Go environment
uses: ./.github/actions/setup-go-env
- name: Validate CI policy
run: go run ./test/ci/tool policy-validate test/ci/suites.yaml
- name: CI preflight
run: scripts/ci/preflight.sh
- name: Install security tools
run: |
go install github.com/securego/gosec/v2/cmd/gosec@v2.22.4
go install golang.org/x/vuln/cmd/govulncheck@v1.1.4
- name: Run gosec (emit JSON for allowlist gate)
continue-on-error: true
run: |
mkdir -p outputs/ci/security-audit
GOSEC_BIN="$(go env GOPATH)/bin/gosec"
"${GOSEC_BIN}" -fmt=json -severity=medium -confidence=medium ./... > outputs/ci/security-audit/gosec.json
- name: Run govulncheck
run: govulncheck ./...
- name: Run custom security checks
env:
CI_SECURITY_DIR: outputs/ci/security-audit
CI_SECURITY_ALLOWLIST_FILE: test/ci/security-allowlist.yaml
run: scripts/ci/security-checks.sh
- name: Summarize security lane
if: always()
env:
CI_LANE: security-audit
CI_STATUS: ${{ job.status }}
CI_LOG_DIR: outputs/ci/security-audit
CI_COVERAGE_FILE: "-"
CI_REPORT_FILE: outputs/ci/security-audit/report.json
CI_SUMMARY_FILE: outputs/ci/security-audit/summary.md
run: scripts/ci/summary.sh
- name: Bundle security artifacts
if: always()
run: |
tar -czf outputs/ci/security-audit-artifacts.tgz -C outputs/ci security-audit || true
ls -lh outputs/ci/security-audit-artifacts.tgz || true
- name: Print security report
if: always()
run: |
test -f outputs/ci/security-audit/report.json && cat outputs/ci/security-audit/report.json || true
test -f outputs/ci/security-audit/gosec.json && head -200 outputs/ci/security-audit/gosec.json || true
secret-scanning:
name: Secret Scanning
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Install gitleaks
run: |
GITLEAKS_VERSION="8.24.3"
GITLEAKS_SHA256="9991e0b2903da4c8f6122b5c3186448b927a5da4deef1fe45271c3793f4ee29c"
ARCHIVE="/tmp/gitleaks.tar.gz"
curl -sSfL -o "${ARCHIVE}" \
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
echo "${GITLEAKS_SHA256} ${ARCHIVE}" | sha256sum -c -
sudo tar -xzf "${ARCHIVE}" -C /usr/local/bin gitleaks
rm -f "${ARCHIVE}"
- name: Run gitleaks (PR diff only)
if: github.event_name == 'pull_request'
run: gitleaks detect --source=. --redact --log-opts="origin/${{ github.base_ref }}..HEAD"
- name: Run gitleaks (full scan on push/schedule)
if: github.event_name != 'pull_request'
run: gitleaks detect --source=. --redact --no-git