Repository navigation
100 lines (87 loc) · 3.15 KB
/
Copy pathsecurity.yml
File metadata and controls
100 lines (87 loc) · 3.15 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
# Weekly security scans -- the same checks CI runs on every push, repeated
# on a schedule so that CVEs disclosed *between* pushes are caught while
# the repository is quiet:
#
# Trivy fixed HIGH/CRITICAL vulnerabilities in what uv.lock resolves
# zizmor the workflows themselves
# gitleaks secrets anywhere in the history
# fuzz ten minutes of the header fuzzer (scripts/fuzz_headers.py),
# which CI runs for only thirty seconds on each pull request
name: Security
on:
schedule:
- cron: "0 6 * * 1" # Mondays 06:00 UTC
workflow_dispatch:
permissions:
contents: read
jobs:
trivy:
name: Trivy scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Scan for vulnerabilities
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: fs
scan-ref: .
format: table
exit-code: "1"
ignore-unfixed: true
vuln-type: library
severity: HIGH,CRITICAL
security:
name: Workflows and secrets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- uses: astral-sh/setup-uv@v7
- name: Workflows
run: uvx zizmor --min-severity medium .github/workflows
# The gitleaks binary rather than gitleaks/gitleaks-action, which
# needs a licence key (GITLEAKS_LICENSE) in a repository owned by an
# organisation. Pinned to a release and its checksum.
- name: Secrets in the history
env:
GITLEAKS_VERSION: 8.30.1
GITLEAKS_SHA256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb
run: |
set -euo pipefail
tarball="gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
curl -fsSLO "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/${tarball}"
echo "${GITLEAKS_SHA256} ${tarball}" | sha256sum --check -
tar -xzf "$tarball" gitleaks
./gitleaks git --no-banner --redact --verbose .
fuzz:
name: Fuzz the header readers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install the package with the development extra
run: pip install -e '.[dev]'
# Ten minutes, seeded by the run id so that a finding can be
# repeated by hand with `--seed <run id>`. The id reaches the script
# through the environment, never by interpolation into the command.
- name: Fuzz for ten minutes
env:
FUZZ_SEED: ${{ github.run_id }}
run: python scripts/fuzz_headers.py --seconds 600 --seed "$FUZZ_SEED"
# Only when the fuzzer found something: the inputs and the traceback
# beside each, for turning into a test.
- name: Keep the findings
if: failure()
uses: actions/upload-artifact@v7
with:
name: fuzz-findings
path: fuzz-findings/
if-no-files-found: ignore