Add post-merge security workflow #45

Merged
amiryahaya merged 1 commit from ci/security-workflow into main 2026-10-22 18:49:30 +02:00
Owner

Adds a security workflow that runs after every merge to main (a merged pull request is a push to main) and on manual dispatch. It scans what is now on main; it supports review and does not replace it, and a passing run makes no compliance claim.

What it adds

.forgejo/workflows/security.yml (read-only permissions, no secrets, same pinned checkout, toolchain and artifact actions as CI):

  • Rust dependency advisories: cargo audit --deny warnings (pinned 0.22.2; older versions cannot parse the current CVSS 4.0 advisories) and scripts/check-audit-ignores.sh.
  • npm dependency advisories: scripts/audit-npm.mjs, a gate with 9 unit tests. It fails on any advisory not listed in web/audit-exceptions.txt and on any exception whose review date has passed, so nothing stays accepted silently. A malformed exception line is an error.
  • Secret scan: gitleaks 8.30.1 over the full history, archive verified against a pinned SHA-256, findings redacted.

Each job retains its report as an artifact for 30 days, including after a failure. An unmeasured result (scanner could not run) fails. Documented in docs/operations/ci.md.

What the first local scans found

  • npm: four advisories (two moderate, two critical) in development tooling only (vitest 3.2.7 via @vitest/mocker and tinypool); npm audit --omit=dev reports none. Accepted in web/audit-exceptions.txt until 2026-11-30; the fix is a breaking upgrade to vitest 5, not done here and not yet tracked in an issue.
  • Rust: RUSTSEC-2023-0071 (rsa, Marvin timing attack, no fix available). rsa is only a lockfile entry of sqlx's optional MySQL driver and is not compiled into any binary (cargo tree -i rsa is empty). Ignored in .cargo/audit.toml with the reason, and scripts/check-audit-ignores.sh fails the job if rsa ever joins the build graph.
  • Secrets: no real secrets. One false positive, a TLS group name (SecP256r1MLKEM768) in docs/research-pqc.md, ignored in .gitleaksignore by exact fingerprint, never by path or rule.

Verification

  • node --test scripts/audit-npm.test.mjs: 9 passed (written first; they failed on the missing module before the gate existed).
  • node scripts/audit-npm.mjs: 4 advisories, all covered by a current exception, exit 0; with an empty exceptions file it fails as intended.
  • cargo audit --deny warnings with cargo-audit 0.22.2: passes with the single ignore; it failed on rsa before the ignore. scripts/check-audit-ignores.sh passes.
  • gitleaks 8.30.1 locally: 39 commits scanned, no leaks after the ignore; one finding before it.
  • actionlint passes on the workflow (using the normalization command in docs/operations/ci.md).

Caveats

  • No hosted run yet. There was no Forgejo runner when CI was set up, so this workflow has not run on the real runner. After the first merge, check the repository's Actions page and retain the run URL.
  • The Rust job compiles cargo-audit on every run (a few minutes); caching is a possible later change.
  • There is no weekly schedule: new advisories appear independently of merges, so one is worth adding. Left out because the request was after-merge only.
  • The runner needs network access to github.com (advisory database, gitleaks release, Rust toolchain action), crates.io and the npm registry.

🤖 Generated with Claude Code

Adds a security workflow that runs after every merge to `main` (a merged pull request is a push to `main`) and on manual dispatch. It scans what is now on `main`; it supports review and does not replace it, and a passing run makes no compliance claim. ## What it adds `.forgejo/workflows/security.yml` (read-only permissions, no secrets, same pinned checkout, toolchain and artifact actions as CI): - **Rust dependency advisories:** `cargo audit --deny warnings` (pinned 0.22.2; older versions cannot parse the current CVSS 4.0 advisories) and `scripts/check-audit-ignores.sh`. - **npm dependency advisories:** `scripts/audit-npm.mjs`, a gate with 9 unit tests. It fails on any advisory not listed in `web/audit-exceptions.txt` and on any exception whose review date has passed, so nothing stays accepted silently. A malformed exception line is an error. - **Secret scan:** gitleaks 8.30.1 over the full history, archive verified against a pinned SHA-256, findings redacted. Each job retains its report as an artifact for 30 days, including after a failure. An unmeasured result (scanner could not run) fails. Documented in `docs/operations/ci.md`. ## What the first local scans found - **npm:** four advisories (two moderate, two critical) in development tooling only (`vitest` 3.2.7 via `@vitest/mocker` and `tinypool`); `npm audit --omit=dev` reports none. Accepted in `web/audit-exceptions.txt` until **2026-11-30**; the fix is a breaking upgrade to vitest 5, not done here and not yet tracked in an issue. - **Rust:** `RUSTSEC-2023-0071` (`rsa`, Marvin timing attack, no fix available). `rsa` is only a lockfile entry of sqlx's optional MySQL driver and is not compiled into any binary (`cargo tree -i rsa` is empty). Ignored in `.cargo/audit.toml` with the reason, and `scripts/check-audit-ignores.sh` fails the job if `rsa` ever joins the build graph. - **Secrets:** no real secrets. One false positive, a TLS group name (`SecP256r1MLKEM768`) in `docs/research-pqc.md`, ignored in `.gitleaksignore` by exact fingerprint, never by path or rule. ## Verification - `node --test scripts/audit-npm.test.mjs`: 9 passed (written first; they failed on the missing module before the gate existed). - `node scripts/audit-npm.mjs`: 4 advisories, all covered by a current exception, exit 0; with an empty exceptions file it fails as intended. - `cargo audit --deny warnings` with cargo-audit 0.22.2: passes with the single ignore; it failed on `rsa` before the ignore. `scripts/check-audit-ignores.sh` passes. - gitleaks 8.30.1 locally: 39 commits scanned, no leaks after the ignore; one finding before it. - `actionlint` passes on the workflow (using the normalization command in `docs/operations/ci.md`). ## Caveats - **No hosted run yet.** There was no Forgejo runner when CI was set up, so this workflow has not run on the real runner. After the first merge, check the repository's Actions page and retain the run URL. - The Rust job compiles `cargo-audit` on every run (a few minutes); caching is a possible later change. - There is no weekly schedule: new advisories appear independently of merges, so one is worth adding. Left out because the request was after-merge only. - The runner needs network access to `github.com` (advisory database, gitleaks release, Rust toolchain action), `crates.io` and the npm registry. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ci: add post-merge security workflow
All checks were successful
CI / Web checks (push) Successful in 45s
CI / Web checks (pull_request) Successful in 49s
CI / Rust checks (push) Successful in 10m9s
CI / Rust checks (pull_request) Successful in 12m24s
8f44b570a3
Run dependency advisory and secret scans after every merge to main and
on demand: cargo-audit over Cargo.lock (with a guard that the one
accepted ignore, a lockfile-only rsa entry, still holds), an npm audit
gate whose exceptions need a reason and an unexpired review date (with
unit tests), and gitleaks over the full history with its archive
verified against a pinned SHA-256. Reports are retained as artifacts.

Records the first findings: four dev-only vitest advisories accepted
until 2026-11-30, the lockfile-only rsa advisory, and one gitleaks
false positive ignored by exact fingerprint.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.