Repository navigation
security: lockfile audit must block non-registry sources and missing integrity by default - #8541
Conversation
…integrity by default The pre-install lockfile gate detects non-registry npm resolved URLs, missing npm integrity hashes, non-registry Cargo sources and missing Cargo checksums, but #5604 left all four out of BLOCKING_KINDS, so they only printed a ::warning:: and the script exited 0. Every workflow calls the auditor without --strict immediately before `npm ci`, which runs package lifecycle scripts, so a lockfile pointing at an attacker controlled tarball with a matching integrity value passed the gate and its postinstall ran on the runner. Move those four kinds into BLOCKING_KINDS. An integrity hash written by whoever also wrote the resolved URL proves nothing; the registry origin is what makes it meaningful, so both belong on the blocking side of a pre-install fetch gate. Kinds that describe an incomplete entry rather than a fetchable source (missing-resolved-url, unsupported-lockfile-version) stay advisory, and --strict still escalates everything. All four checked-in lockfiles pass in default mode and under --strict, so no existing job changes colour.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d33e6aa3d3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "non-registry-resolved-url", | ||
| "missing-integrity-hash", | ||
| "non-registry-cargo-source", | ||
| "missing-cargo-checksum", |
There was a problem hiding this comment.
Update --strict help for the new default blockers
When operators inspect --help to choose between default and strict mode, it still states that default mode blocks only known-malicious versions, IOC strings, and broken lockfiles and that everything else exits 0. These newly added provenance/integrity kinds now also exit 1 by default, so the CLI advertises behavior that directly contradicts BLOCKING_KINDS; update the argument help to list the new default blockers.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in f38de75. The help said default mode blocks only known-malicious versions, IOC strings and broken lockfiles and that everything else exits 0, which contradicted BLOCKING_KINDS after this change. It now lists the provenance/integrity blockers and describes --strict as escalating the remaining advisory kinds (an entry with no resolved URL, an unaudited lockfileVersion).
…ockers The --strict help still told operators that default mode blocks only known-malicious versions, IOC strings and broken lockfiles and that everything else exits 0. Provenance and integrity findings now block by default, so --help contradicted BLOCKING_KINDS for anyone deciding whether they needed --strict.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Problem
scripts/lockfile_supply_chain_audit.pyis the pre-install gate: it runs immediately beforenpm ciin five workflows, and thosenpm cisteps deliberately keep lifecycle scripts enabled becausevite buildneeds them (esbuild native binary postinstall).The script correctly detects the four structural conditions it exists to stop:
non-registry-resolved-url(npm tarball fetched from somewhere other than the registry)missing-integrity-hashnon-registry-cargo-sourcemissing-cargo-checksumbut #5604 left all four out of
BLOCKING_KINDS, so in default mode they print a::warning::and the script exits 0. No workflow passes--strict. The gate has been open since that commit.Reproduced on
mainwith a lockfile pointing at a local tarball plus a plausible looking integrity value:Exit 0 means a green check and the next step runs
npm ci, which executes the package'spostinstallon the runner.The reasoning behind the advisory classification does not hold up. An integrity hash written by whoever also wrote the
resolvedURL proves nothing; it is a fingerprint of bytes the attacker chose. Registry origin is the only thing that makes the hash meaningful, so origin and integrity both belong on the blocking side. The known-malicious version table and IOC strings that did stay blocking only catch attacks somebody already published indicators for; the structural check is the layer that catches a novel one.Fix
Move those four kinds into
BLOCKING_KINDS. Kinds that describe an incomplete entry rather than a fetchable source (missing-resolved-url,unsupported-lockfile-version) stay advisory, which keeps the noise floor low.--strictstill escalates everything.No existing job changes colour
--stricttests/security/npm cistudio-tauri-smoke.ymlrunsnpm install --prefix studio @tauri-apps/[email protected]before the audit, so it mutatesstudio/package-lock.jsonon the runner. Simulated with npm 11.9.0: the only change is the root dependency range"2.10.1"to"^2.10.1", no package entries change, and the mutated lockfile still audits clean.This is CI only. Nothing in Studio, Desktop, the installers or the notebooks imports this script, so there is no user facing behaviour change.
The one intended behaviour change: a future PR that deliberately adds a git or
file:dependency now fails instead of warning. Cargo already hasCARGO_SOURCE_ALLOWLISTfor that case (it is howfix-path-envis pinned), and npm hasNPM_REGISTRY_PREFIXES_ALLOWED.Tests
test_malicious_cargo_lockfile_default_mode_advisoryasserted the old exit 0 behaviour. Replaced withtest_malicious_cargo_lockfile_default_mode_blocks.test_provenance_kinds_block_by_defaultandtest_non_registry_npm_tarball_blocks_by_default(the PoC, as a test).::error::path, and a new advisory case usingmissing-resolved-urlkeeps the::warning::path covered.