Repository navigation
65 lines (59 loc) · 1.96 KB
/
Copy pathsecurity.yml
File metadata and controls
65 lines (59 loc) · 1.96 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
name: Security
on:
push:
branches: [main]
pull_request:
schedule:
- cron: "0 4 * * 1"
workflow_dispatch:
permissions:
contents: read
actions: read
concurrency:
group: security-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
npm-audit:
name: npm audit (production deps)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci --no-audit --no-fund
- name: npm audit (high+)
run: npm audit --omit=dev --audit-level=high
osv-scanner:
name: OSV vulnerability scan
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install osv-scanner
run: |
curl -sSL -o /tmp/osv-scanner \
https://github.com/google/osv-scanner/releases/latest/download/osv-scanner_linux_amd64
chmod +x /tmp/osv-scanner
- name: Scan dependencies (report-only)
# CLI (not the reusable workflow): the reusable workflow requires
# GitHub Code Scanning which is unavailable on free private repos.
# Report-only: dev-dep advisories surfaced here; production deps are
# gated by the `npm audit` job below.
run: /tmp/osv-scanner scan --lockfile=package-lock.json || true
gitleaks:
name: Secret scanning (gitleaks)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install gitleaks
run: |
VERSION=8.21.2
curl -sSL "https://github.com/gitleaks/gitleaks/releases/download/v${VERSION}/gitleaks_${VERSION}_linux_x64.tar.gz" \
| tar -xz -C /usr/local/bin gitleaks
- name: Scan repository history
# Use the CLI directly: gitleaks-action@v2 needs write API perms that
# GITHUB_TOKEN does not have in private repos.
run: gitleaks detect --redact --no-banner --verbose --exit-code 1