Skip to content

Commit ca12fa9

Browse files
committed
ci: add security job with npm audit, gitleaks, and build size gate
- npm audit fails on high/critical dependency vulnerabilities - Gitleaks scans full history for accidentally committed secrets - Build output size gate at 150 KB catches unexpected bloat - Gitleaks allowlist excludes node_modules, dist, coverage, lockfile
1 parent 8fc04d5 commit ca12fa9

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,39 @@ jobs:
1818
- run: npm ci
1919
- run: npx tsc --noEmit
2020
- run: npx vitest run --coverage --passWithNoTests
21+
22+
security:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v6
26+
with:
27+
fetch-depth: 0
28+
29+
- uses: actions/setup-node@v6
30+
with:
31+
node-version: 22.22.0
32+
cache: npm
33+
34+
- run: npm ci
35+
36+
# Dependency audit — fail on high/critical vulnerabilities
37+
- name: npm audit
38+
run: npm audit --audit-level=high
39+
40+
# Secret scanning with gitleaks
41+
- name: Gitleaks secret scan
42+
uses: gitleaks/gitleaks-action@v2
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
46+
47+
# Build output size gate — single-file HTML should stay under 150 KB
48+
- name: Build and check output size
49+
run: |
50+
npm run build
51+
size=$(stat -c%s dist/index.html)
52+
echo "Build output: ${size} bytes"
53+
if [ "$size" -gt 153600 ]; then
54+
echo "::error::Build output exceeds 150 KB (${size} bytes) — unexpected bloat"
55+
exit 1
56+
fi

.gitleaks.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Gitleaks configuration
2+
# https://github.com/gitleaks/gitleaks
3+
4+
title = "compose-debugger gitleaks config"
5+
6+
[allowlist]
7+
description = "Global allowlist"
8+
paths = [
9+
'''node_modules/''',
10+
'''dist/''',
11+
'''coverage/''',
12+
'''package-lock\.json''',
13+
]

0 commit comments

Comments
 (0)