From 7056f5cdb5871101230578cf1878c3b5a2685d76 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Sat, 5 Dec 2026 05:13:58 +0000 Subject: [PATCH 1/2] Audit workflow: cargo-deny (advisories, licences, sources) for the three Rust workspaces and Trivy for every lockfile, failing on stale ignores (sc-9611) Starts green: pin-project-lite 0.2.18 (yanked) updated; rsa's Marvin advisory ignored (dev-dependency only); jsonwebtoken's CVE-2026-25537 ignored until 5 Jun 2027 (app/ only signs JWTs; the upgrade is its own story). pnpm audit isn't used: it reads the gallery workspace's astro/ folder as the astro package and reports 19 false advisories. Its own workflow, so a new advisory never holds back the CLI release (release.yml follows CI). --- .github/workflows/audit.yml | 49 ++++++++++++++++++ .trivyignore.yaml | 10 ++++ AGENTS.md | 6 +++ Cargo.lock | 4 +- clients/gallery/rust/deny.toml | 35 +++++++++++++ clients/gallery/rust/examples/loco/deny.toml | 39 ++++++++++++++ deny.toml | 53 ++++++++++++++++++++ mise.toml | 4 +- 8 files changed, 197 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/audit.yml create mode 100644 .trivyignore.yaml create mode 100644 clients/gallery/rust/deny.toml create mode 100644 clients/gallery/rust/examples/loco/deny.toml create mode 100644 deny.toml diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 00000000..fb65cdb9 --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,49 @@ +# Known vulnerabilities and licences in the dependencies: cargo-deny for the three Rust workspaces (deny.toml beside +# each manifest: RustSec advisories, licences, sources), Trivy for every lockfile (Cargo, pnpm, Bundler, pip; dev +# dependencies included, fixable findings only, ignores in .trivyignore.yaml with an expiry). An ignore or an allowed +# licence that no longer matches anything fails too. +# +# Its own workflow, not CI's: a new advisory can turn it red without any change here, and CI's result on main decides +# the CLI release (release.yml). Pull requests run it (a required check), and so does a daily run on main, whose +# failure reaches the coordinator like any other. +name: Audit + +on: + pull_request: + push: + branches: [main] + schedule: + - cron: "41 4 * * *" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: audit-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +jobs: + audit: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false + - uses: jdx/mise-action@924e7c586e33d7d4bae9c14e26c5d22e2beb6e78 # v5.3.0 + with: + install_args: cargo-deny trivy + - name: cargo-deny + run: | + status=0 + for manifest in Cargo.toml clients/gallery/rust/Cargo.toml clients/gallery/rust/examples/loco/Cargo.toml; do + echo "::group::$manifest" + cargo deny --manifest-path "$manifest" check -D advisory-not-detected -D license-not-encountered || status=1 + echo "::endgroup::" + done + exit $status + - name: Trivy (lockfiles) + run: >- + trivy fs --scanners vuln --include-dev-deps --ignore-unfixed --exit-code 1 + --ignorefile .trivyignore.yaml --skip-dirs target --skip-dirs '**/node_modules' . diff --git a/.trivyignore.yaml b/.trivyignore.yaml new file mode 100644 index 00000000..9c70261d --- /dev/null +++ b/.trivyignore.yaml @@ -0,0 +1,10 @@ +# Trivy ignores, for CI's audit job (dependency lockfiles) and the image scan. Each entry says why it doesn't apply +# and expires within six months (expired_at), when it fails again and gets another look. +vulnerabilities: + - id: CVE-2026-25537 + paths: ["Cargo.lock"] + statement: >- + jsonwebtoken 9.3.1 skips nbf/exp validation for a claim of the wrong JSON type. app/ only signs JWTs (the GitHub + App's, forge/github_app.rs) and never decodes or validates one with this crate. Reviewed 5 Dec 2026 (sc-9611); + the upgrade to 10.3+ is its own story. + expired_at: 2027-06-05 diff --git a/AGENTS.md b/AGENTS.md index 2908f69e..7675ac83 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,6 +23,12 @@ design is in `docs/design.md`; read it before changing the architecture, and upd it). Ignore a zizmor finding only inline (`# zizmor: ignore[audit]`) with the reason beside it; allow a made-up value in `.betterleaks.toml` only with a description of what it is. A real secret that reached a commit is revoked, not allowlisted. +- **Dependencies are audited** by the Audit workflow (on pull requests and daily on main): cargo-deny for the Rust + workspaces (a `deny.toml` beside each manifest: advisories, licences, sources) and Trivy for every lockfile. Fix a + finding by upgrading. An ignore says why it doesn't apply: in `deny.toml` with a `reason`, in `.trivyignore.yaml` + with a `statement` and an `expired_at` at most six months out. A new dependency licence goes into `deny.toml`'s + allow list only after a look (no copyleft in the CLI or the images). Ignores and licences nothing uses any more + fail the job: remove them. - **Hold the merge lock from the final rebase to the merge.** A PR must be up to date with `main` before it merges, so a merge by one agent sends every other agent's PR back through CI. Take Fleetlayer's lock, one per repository, around the last rebase, the CI run and the merge, in one script, and only for one PR at a time: diff --git a/Cargo.lock b/Cargo.lock index 499d46e3..78b1636d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3455,9 +3455,9 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pin-project-lite" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752" +checksum = "f120c8d5021b34abd2f2ffd7ee96687cbcd6c54a3e68d86b6169f4a5cd480ffe" [[package]] name = "pkcs1" diff --git a/clients/gallery/rust/deny.toml b/clients/gallery/rust/deny.toml new file mode 100644 index 00000000..24099798 --- /dev/null +++ b/clients/gallery/rust/deny.toml @@ -0,0 +1,35 @@ +# cargo-deny for the visualci-gallery crate (published on crates.io), run by CI's audit job with +# `-D advisory-not-detected -D license-not-encountered` like the root's: an entry that no longer matches fails. + +[graph] +all-features = true + +[advisories] +yanked = "deny" + +[licenses] +# What its dependency graph uses today, all permissive. +allow = [ + "0BSD", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "BSD-3-Clause", + "CDLA-Permissive-2.0", + "ISC", + "MIT", + "Unicode-3.0", + "Unlicense", + "Zlib", +] +confidence-threshold = 0.8 + +[licenses.private] +ignore = true + +[bans] +multiple-versions = "allow" + +[sources] +unknown-registry = "deny" +unknown-git = "deny" +allow-registry = ["https://github.com/rust-lang/crates.io-index"] diff --git a/clients/gallery/rust/examples/loco/deny.toml b/clients/gallery/rust/examples/loco/deny.toml new file mode 100644 index 00000000..3c5d50ee --- /dev/null +++ b/clients/gallery/rust/examples/loco/deny.toml @@ -0,0 +1,39 @@ +# cargo-deny for the gallery's Loco example (an example app, never published or shipped), run by CI's audit job with +# `-D advisory-not-detected -D license-not-encountered` like the root's. + +[graph] +all-features = true + +[advisories] +yanked = "deny" + +[licenses] +# What Loco's graph uses today. MPL-2.0 (colored, a file-level copyleft) is fine in an example nobody ships. +allow = [ + "0BSD", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "BSD-2-Clause", + "BSD-3-Clause", + "BSL-1.0", + "CC0-1.0", + "CDLA-Permissive-2.0", + "ISC", + "MIT", + "MPL-2.0", + "Unicode-3.0", + "Unlicense", + "Zlib", +] +confidence-threshold = 0.8 + +[licenses.private] +ignore = true + +[bans] +multiple-versions = "allow" + +[sources] +unknown-registry = "deny" +unknown-git = "deny" +allow-registry = ["https://github.com/rust-lang/crates.io-index"] diff --git a/deny.toml b/deny.toml new file mode 100644 index 00000000..543f1540 --- /dev/null +++ b/deny.toml @@ -0,0 +1,53 @@ +# cargo-deny: known vulnerabilities (RustSec), licences, banned crates and where crates come from, for the root +# workspace. clients/gallery/rust and its Loco example have their own deny.toml (cargo-deny reads the one beside the +# manifest), since each lists only what its own graph uses. CI's audit job runs +# `cargo deny check -D advisory-not-detected -D license-not-encountered`, so an ignore or an allowed licence that no +# longer matches anything fails too: remove it. + +[graph] +all-features = true + +[advisories] +# Yanked crates fail: `cargo update -p `. +yanked = "deny" +ignore = [ + # rsa: the Marvin timing attack (no fixed release in the 0.9 series). A dev-dependency only: app/'s tests sign test + # JWTs with it; nothing that ships uses it. Reviewed 5 Dec 2026 (sc-9611). + { id = "RUSTSEC-2023-0071", reason = "dev-dependency only (app/ tests); nothing shipped decrypts or signs with it" }, +] + +[licenses] +# What the dependency graph uses today, all permissive. A new licence needs a look first: copyleft (GPL, AGPL, LGPL-only) +# doesn't go into the CLI or the server images. +allow = [ + "0BSD", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "BSD-2-Clause", + "BSD-3-Clause", + "BSL-1.0", + "CC0-1.0", + "CDLA-Permissive-2.0", + "ISC", + "MIT", + "MIT-0", + "Unicode-3.0", + "Unlicense", + "Zlib", +] +confidence-threshold = 0.8 + +[licenses.private] +# Our own unpublished crates (publish = false) aren't checked against the list. +ignore = true + +[bans] +multiple-versions = "allow" +# Allowed: the only wildcards are the CLI's and renderer's path dependencies on our own crates (shipped as binaries, +# never published), and crates.io refuses a published crate with a wildcard anyway. +wildcards = "allow" + +[sources] +unknown-registry = "deny" +unknown-git = "deny" +allow-registry = ["https://github.com/rust-lang/crates.io-index"] diff --git a/mise.toml b/mise.toml index 75ee0f6f..9ef23327 100644 --- a/mise.toml +++ b/mise.toml @@ -1,4 +1,4 @@ -# Tool versions for the frontend, scripts, git hooks and CI's security job (mise). scripts/on-dev loads them on +# Tool versions for the frontend, scripts, git hooks and CI's security and audit jobs (mise). scripts/on-dev loads them on # docspring-dev, where mise has no global default node. [tools] node = "24.21.0" @@ -7,3 +7,5 @@ actionlint = "1.7.12" shellcheck = "0.12.0" zizmor = "1.33.1" betterleaks = "1.10.1" +cargo-deny = "0.22.3" +trivy = "0.77.0" From 5d1a83b65a9e00b5469477598aee35265c54bc89 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Sat, 5 Dec 2026 05:25:11 +0000 Subject: [PATCH 2/2] Audit: the Rails example's Sprockets lockfile scanned too; only deny.toml fails on stale entries, Trivy ignores expire (sc-9611) --- .github/workflows/audit.yml | 11 +++++++++-- AGENTS.md | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index fb65cdb9..10ae1c44 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -1,7 +1,7 @@ # Known vulnerabilities and licences in the dependencies: cargo-deny for the three Rust workspaces (deny.toml beside # each manifest: RustSec advisories, licences, sources), Trivy for every lockfile (Cargo, pnpm, Bundler, pip; dev -# dependencies included, fixable findings only, ignores in .trivyignore.yaml with an expiry). An ignore or an allowed -# licence that no longer matches anything fails too. +# dependencies included, fixable findings only, ignores in .trivyignore.yaml with an expiry). In deny.toml, an ignore or +# an allowed licence that no longer matches anything fails too; a Trivy ignore fails again when it expires. # # Its own workflow, not CI's: a new advisory can turn it red without any change here, and CI's result on main decides # the CLI release (release.yml). Pull requests run it (a required check), and so does a daily run on main, whose @@ -47,3 +47,10 @@ jobs: run: >- trivy fs --scanners vuln --include-dev-deps --ignore-unfixed --exit-code 1 --ignorefile .trivyignore.yaml --skip-dirs target --skip-dirs '**/node_modules' . + # Trivy only knows lockfiles by their usual names: the Rails example's second bundle (the Sprockets one ci.yml + # tests) goes in under Gemfile.lock. + - name: Trivy (Rails example, Sprockets bundle) + run: | + dir=$RUNNER_TEMP/sprockets && mkdir -p "$dir" + cp clients/gallery/ruby/examples/rails/Gemfile.sprockets.lock "$dir/Gemfile.lock" + trivy fs --scanners vuln --ignore-unfixed --exit-code 1 --ignorefile .trivyignore.yaml "$dir" diff --git a/AGENTS.md b/AGENTS.md index 7675ac83..421a69c2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -27,8 +27,8 @@ design is in `docs/design.md`; read it before changing the architecture, and upd workspaces (a `deny.toml` beside each manifest: advisories, licences, sources) and Trivy for every lockfile. Fix a finding by upgrading. An ignore says why it doesn't apply: in `deny.toml` with a `reason`, in `.trivyignore.yaml` with a `statement` and an `expired_at` at most six months out. A new dependency licence goes into `deny.toml`'s - allow list only after a look (no copyleft in the CLI or the images). Ignores and licences nothing uses any more - fail the job: remove them. + allow list only after a look (no copyleft in the CLI or the images). In `deny.toml`, ignores and licences nothing + uses any more fail the job: remove them. - **Hold the merge lock from the final rebase to the merge.** A PR must be up to date with `main` before it merges, so a merge by one agent sends every other agent's PR back through CI. Take Fleetlayer's lock, one per repository, around the last rebase, the CI run and the merge, in one script, and only for one PR at a time: