ci(security): add a supply-chain gate, checksums and an SBOM
The project shipped signed Android builds and unsigned desktop binaries
with no vulnerability scanning of any kind. Nothing checked the ~500
crate Rust graph or the JS packages against an advisory feed, and nothing
checked that what we redistribute inside an MIT bundle permits it.
The first cargo-deny run found eight vulnerabilities and one
unsoundness -- bytes, four in rustls-webpki, time, two in quick-xml and
rand -- every one of them closed by a `cargo update` nobody had a reason
to run. That update is in this commit; 740 Rust tests and clippy
-D warnings pass on the new lockfile.
Two structural fixes matter as much as the gate itself:
- deny.toml scopes the graph to the targets we actually ship. Without
it the Apple targets pull in plist -> quick-xml and report two DoS
advisories against a crate that is in no binary we release. Ignoring
those by ID would silence them everywhere, including where they
would matter; scoping makes them correctly absent.
- libmpv is pinned by rev instead of branch = "master". A branch means
the revision is whatever Cargo.lock happens to hold and any
`cargo update` silently substitutes new upstream code -- in the one
dependency that is not from crates.io and that links a C library
into the player. The rev is the commit already locked, so this pins
current behaviour rather than changing it.
Licence findings are recorded rather than waved through. libmpv and
libmpv-sys are LGPL-2.1, satisfied here by dynamic linking against the
system library; deny.toml carries the two obligations that follow (keep
the linkage dynamic, ship libmpv's licence text with any bundle carrying
the .so). MPL-2.0 crates are file-level copyleft and fine unmodified.
Releases now publish SHA256SUMS (verified in-job with `sha256sum -c`
before upload) and a CycloneDX SBOM for both halves, so "does this
release contain <vulnerable crate>?" has an answer that is not "rebuild
the tag and re-resolve it".
Workflows pin jellytau-builder:2026.08 instead of :latest. While every
job said :latest, rebuilding the image changed what every build compiled
against, including rebuilds of old release tags.
Also folded in, because both were the same class of problem:
- publish-docs.yml downloaded mdBook from GitHub releases into
/usr/local/bin at job time -- a toolchain install in CI, which
CLAUDE.md explicitly forbids, and a hard dependency on GitHub's CDN
at publish time. It is in the builder image now.
- extract-traces.ts only ever read .ts/.svelte/.rs, so every
requirement implemented by *configuration* was invisible to the
matrix that measures it. DR-205, DR-206, DR-207 and DR-215 all carry
TRACES comments nothing read, and each counted as uncovered while
being covered. Coverage was really 90%, not 88%; MIN_THRESHOLD moves
to 89 accordingly. CI workflows stay excluded and there is a test
saying why: traceability-check.yml quotes "a TRACES: comment" beside
deliberately-undefined example IDs, which the extractor would read
as real traces and then fail its own dangling-ID check.
Supply-chain requirement is DR-216.
🔴 The builder image must be rebuilt and pushed
(scripts/build-builder-image.sh 2026.08) before this reaches master --
the workflows now name a tag and tools that do not exist in the registry
yet.
This commit is contained in:
+80
-13
@@ -56,7 +56,7 @@ export interface TracesData {
|
||||
*
|
||||
* TRACES: | DR-093
|
||||
*/
|
||||
export const MIN_COVERAGE_PERCENT = 88;
|
||||
export const MIN_COVERAGE_PERCENT = 89;
|
||||
|
||||
// Repo root, derived from this script's location (scripts/ -> repo root).
|
||||
// Must NOT be hardcoded to a developer's machine, or CI checkouts see no files.
|
||||
@@ -75,6 +75,71 @@ function extractRequirementIds(tracesString: string): string[] {
|
||||
return matches.map((m) => `${m[1]}-${m[2]}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tooling files that implement a requirement.
|
||||
*
|
||||
* The walker below only visits `src/`, `src-tauri/src/` and `scripts/`, and only
|
||||
* picks up `.ts`/`.svelte`/`.rs`. That made every requirement implemented by
|
||||
* *configuration* invisible to the matrix that measures it — DR-205
|
||||
* (eslint.config.js), DR-206 (rust-toolchain.toml), DR-207 (the pre-commit
|
||||
* hook) and DR-216 (deny.toml) all carry TRACES comments that nothing read, so
|
||||
* each was counted as uncovered while being covered.
|
||||
*
|
||||
* An explicit list rather than "also scan .toml/.js/.yml": most config files in
|
||||
* this repo implement nothing, and one class of file is actively dangerous to
|
||||
* scan — see `isTracedSourceFile`.
|
||||
*/
|
||||
const TOOLING_FILES = new Set([
|
||||
"eslint.config.js",
|
||||
"vitest.config.ts",
|
||||
"scripts/hooks/pre-commit",
|
||||
"src-tauri/deny.toml",
|
||||
"src-tauri/rust-toolchain.toml",
|
||||
]);
|
||||
|
||||
/** Directory names that never contain hand-written traced source. */
|
||||
const EXCLUDED_SEGMENTS = new Set([
|
||||
"node_modules",
|
||||
"target",
|
||||
"build",
|
||||
".git",
|
||||
".svelte-kit",
|
||||
"docs-site",
|
||||
// Tauri regenerates src-tauri/gen/ on every android/desktop init; the
|
||||
// canonical Android sources live in src-tauri/android/ and are synced into it.
|
||||
"gen",
|
||||
]);
|
||||
|
||||
/**
|
||||
* Decide whether a repo-relative path should be scanned for TRACES comments.
|
||||
*
|
||||
* Exported for scripts/extract-traces.test.ts — the file-walking half needs a
|
||||
* filesystem, this half is a pure decision and is where the mistakes live.
|
||||
*
|
||||
* Deliberately excluded:
|
||||
* - `docs/requirements.md` *defines* IDs and `docs/traceability.md` is
|
||||
* generated from traces; scanning either would make requirements trace to
|
||||
* themselves.
|
||||
* - `.gitea/workflows/*.yml` — traceability-check.yml explains the gate in
|
||||
* prose, quoting "a `TRACES:` comment" on the same line as example IDs that
|
||||
* are deliberately undefined. The extractor would read those as real traces
|
||||
* and then fail its own dangling-ID check.
|
||||
*/
|
||||
export function isTracedSourceFile(relativePath: string): boolean {
|
||||
const p = relativePath.split(path.sep).join("/");
|
||||
if (p.split("/").some((segment) => EXCLUDED_SEGMENTS.has(segment))) {
|
||||
return false;
|
||||
}
|
||||
if (TOOLING_FILES.has(p)) {
|
||||
return true;
|
||||
}
|
||||
const isSourceExtension = p.endsWith(".ts") || p.endsWith(".svelte") || p.endsWith(".rs");
|
||||
if (!isSourceExtension) {
|
||||
return false;
|
||||
}
|
||||
return p.startsWith("src/") || p.startsWith("src-tauri/src/") || p.startsWith("scripts/");
|
||||
}
|
||||
|
||||
function getAllSourceFiles(): string[] {
|
||||
const baseDir = BASE_DIR;
|
||||
// `scripts` is scanned too: build tooling implements requirements (e.g.
|
||||
@@ -90,23 +155,16 @@ function getAllSourceFiles(): string[] {
|
||||
const fullPath = path.join(dir, entry.name);
|
||||
const relativePath = path.relative(baseDir, fullPath);
|
||||
|
||||
// Skip node_modules, target, build
|
||||
if (
|
||||
relativePath.includes("node_modules") ||
|
||||
relativePath.includes("target") ||
|
||||
relativePath.includes("build") ||
|
||||
relativePath.includes(".git")
|
||||
) {
|
||||
// Directory pruning still happens here so the walk does not descend
|
||||
// into node_modules/target at all; isTracedSourceFile repeats the rule
|
||||
// for individual files (and is the version under test).
|
||||
if (entry.isDirectory() && !isTracedSourceFile(path.join(relativePath, "x.ts"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
walkDir(fullPath);
|
||||
} else if (
|
||||
entry.name.endsWith(".ts") ||
|
||||
entry.name.endsWith(".svelte") ||
|
||||
entry.name.endsWith(".rs")
|
||||
) {
|
||||
} else if (isTracedSourceFile(relativePath)) {
|
||||
files.push(fullPath);
|
||||
}
|
||||
}
|
||||
@@ -122,6 +180,15 @@ function getAllSourceFiles(): string[] {
|
||||
}
|
||||
}
|
||||
|
||||
// eslint.config.js, deny.toml and rust-toolchain.toml sit at the repo root or
|
||||
// in src-tauri/ rather than under a walked root, so they are added by name.
|
||||
for (const toolingFile of TOOLING_FILES) {
|
||||
const fullPath = path.join(baseDir, toolingFile);
|
||||
if (fs.existsSync(fullPath) && !files.includes(fullPath)) {
|
||||
files.push(fullPath);
|
||||
}
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user