Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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). 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
# 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' .
# 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"
10 changes: 10 additions & 0 deletions .trivyignore.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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). 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:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions clients/gallery/rust/deny.toml
Original file line number Diff line number Diff line change
@@ -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"]
39 changes: 39 additions & 0 deletions clients/gallery/rust/examples/loco/deny.toml
Original file line number Diff line number Diff line change
@@ -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"]
53 changes: 53 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -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 <crate>`.
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"]
4 changes: 3 additions & 1 deletion mise.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Loading