Closes#330. MVP-0 class: this is the production path, since source_only did not switch these off.
The problem
The SBOM stage ran dependency resolvers over tenant manifests with no gate, and each one connects wherever the scanned repository says, outside net_guard:
Tool
Redirected by
Verified against
npm install --package-lock-only
a committed .npmrcor a URL dependency in package.json (even with the registry forced)
127.0.0.1:9
cargo generate-lockfile
a committed .cargo/config.tomlor a git dependency in Cargo.toml
127.0.0.1:9
cargo metadata
the same: it downloads every dependency to read licences
— (same resolver)
cargo audit
a committed .cargo/audit.toml: [database] url picks the advisory host, and [advisories] ignore silences the repository's own advisories in our report
https host of choice; ignore honoured
Because the manifest itself names hosts, forcing our registry or removing config files cannot close this (#330's follow-up comment has the transcripts). A resolver run over a tenant's manifest is egress to hosts the tenant picks, by construction.
The fix
npm lockfile generation, cargo generate-lockfile and cargo metadata are gated by the same opt-in as pip-compile (PW_ALLOW_UNTRUSTED_CODE_EXEC, ignored in hardened deployments). ExecPolicy now covers both kinds of stage — ones that run tenant code and ones that connect where the tenant chooses — and logs an accurate reason for each.
cargo audit keeps running (it only talks to the trusted RustSec database), but from a fresh, empty directory with --file <repo>/Cargo.lock. The repository's audit.toml is out of reach: no redirect, no silenced advisories. Verified with a planted config: default database, "ignore": [].
Lockfile generation is now one pure plan (needed_generators) plus an executor, so the gate is testable without spawning anything.
A second wrong-versions bug: pip-compile did not count uv.lock as a lockfile, so with the opt-in on it re-resolved a uv project and wrote a fresh requirements.txt beside the pinned lock — the same shape as the Bun bug in #331. The npm and pip lockfile lists are now shared constants used everywhere.
What customers see
A manifest without a lockfile already records a skipped sbom_dependencies stage naming the file to commit (#331). docs/guide/scanning.md now lists the resolver stages, says commit your lockfile, and explains the cargo audit isolation; .env.example is updated to match.
Nightly
js-no-lockfile no longer resolves a lockfile: its SBOM is empty and it records sbom_dependencies as skipped, like py-bare-pyproject. It also no longer touches the network. No other baseline changes.
Tests
the_default_policy_resolves_nothing: a tree with Cargo.toml, package.json (with a URL dependency to 127.0.0.1) and pyproject.toml; under the default policy no lockfile appears.
a_generator_is_needed_only_where_nothing_pins_the_ecosystem, including uv, bun and pnpm locked projects.
audit_runs_outside_the_repository: working directory, arguments, cleanup.
Closes #330. MVP-0 class: this is the production path, since `source_only` did not switch these off.
## The problem
The SBOM stage ran dependency resolvers over tenant manifests with no gate, and each one connects wherever the **scanned repository** says, outside `net_guard`:
| Tool | Redirected by | Verified against |
|---|---|---|
| `npm install --package-lock-only` | a committed `.npmrc` **or** a URL dependency in `package.json` (even with the registry forced) | `127.0.0.1:9` |
| `cargo generate-lockfile` | a committed `.cargo/config.toml` **or** a git dependency in `Cargo.toml` | `127.0.0.1:9` |
| `cargo metadata` | the same: it downloads every dependency to read licences | — (same resolver) |
| `cargo audit` | a committed `.cargo/audit.toml`: `[database] url` picks the advisory host, and **`[advisories] ignore` silences the repository's own advisories in our report** | https host of choice; `ignore` honoured |
Because the manifest itself names hosts, forcing our registry or removing config files cannot close this (#330's follow-up comment has the transcripts). A resolver run over a tenant's manifest is egress to hosts the tenant picks, by construction.
## The fix
- **npm lockfile generation, `cargo generate-lockfile` and `cargo metadata` are gated** by the same opt-in as pip-compile (`PW_ALLOW_UNTRUSTED_CODE_EXEC`, ignored in hardened deployments). `ExecPolicy` now covers both kinds of stage — ones that run tenant code and ones that connect where the tenant chooses — and logs an accurate reason for each.
- **`cargo audit` keeps running** (it only talks to the trusted RustSec database), but from a fresh, empty directory with `--file <repo>/Cargo.lock`. The repository's `audit.toml` is out of reach: no redirect, no silenced advisories. Verified with a planted config: default database, `"ignore": []`.
- Lockfile generation is now one pure plan (`needed_generators`) plus an executor, so the gate is testable without spawning anything.
- **A second wrong-versions bug:** pip-compile did not count `uv.lock` as a lockfile, so with the opt-in on it re-resolved a uv project and wrote a fresh `requirements.txt` beside the pinned lock — the same shape as the Bun bug in #331. The npm and pip lockfile lists are now shared constants used everywhere.
## What customers see
A manifest without a lockfile already records a skipped `sbom_dependencies` stage naming the file to commit (#331). `docs/guide/scanning.md` now lists the resolver stages, says **commit your lockfile**, and explains the `cargo audit` isolation; `.env.example` is updated to match.
## Nightly
`js-no-lockfile` no longer resolves a lockfile: its SBOM is empty and it records `sbom_dependencies` as skipped, like `py-bare-pyproject`. It also no longer touches the network. No other baseline changes.
## Tests
- `the_default_policy_resolves_nothing`: a tree with `Cargo.toml`, `package.json` (with a URL dependency to 127.0.0.1) and `pyproject.toml`; under the default policy no lockfile appears.
- `a_generator_is_needed_only_where_nothing_pins_the_ecosystem`, including uv, bun and pnpm locked projects.
- `audit_runs_outside_the_repository`: working directory, arguments, cleanup.
- `the_resolution_skip_reason_says_why_it_is_not_code_execution`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
npm lockfile generation, `cargo generate-lockfile` and `cargo metadata`
ran over tenant manifests with no gate, and each connects wherever the
scanned repository says: a committed .npmrc or .cargo/config.toml, or a
URL or git dependency in the manifest itself — outside net_guard. Forcing
our own registry cannot help when the manifest names the host, so they
are now gated like pip-compile, under the same opt-in, with a skip reason
that says why (egress, not code execution).
`cargo audit` read .cargo/audit.toml from the repository too, which could
point it at another advisory database or `ignore` the repository's own
advisories — silencing findings in our report. It keeps running, from a
fresh empty directory with `--file <repo>/Cargo.lock`.
Lockfile generation is now a pure plan plus an executor, and the npm and
pip lockfile lists are shared: pip-compile no longer re-resolves a uv
project and writes a second, fresh requirements.txt beside uv.lock.
The js-no-lockfile nightly target now records `sbom_dependencies` as
skipped instead of resolving; the scanning guide says to commit a lockfile.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang
merged commit c6d2d07999 into main2026-09-23 08:59:35 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #330. MVP-0 class: this is the production path, since
source_onlydid not switch these off.The problem
The SBOM stage ran dependency resolvers over tenant manifests with no gate, and each one connects wherever the scanned repository says, outside
net_guard:npm install --package-lock-only.npmrcor a URL dependency inpackage.json(even with the registry forced)127.0.0.1:9cargo generate-lockfile.cargo/config.tomlor a git dependency inCargo.toml127.0.0.1:9cargo metadatacargo audit.cargo/audit.toml:[database] urlpicks the advisory host, and[advisories] ignoresilences the repository's own advisories in our reportignorehonouredBecause the manifest itself names hosts, forcing our registry or removing config files cannot close this (#330's follow-up comment has the transcripts). A resolver run over a tenant's manifest is egress to hosts the tenant picks, by construction.
The fix
cargo generate-lockfileandcargo metadataare gated by the same opt-in as pip-compile (PW_ALLOW_UNTRUSTED_CODE_EXEC, ignored in hardened deployments).ExecPolicynow covers both kinds of stage — ones that run tenant code and ones that connect where the tenant chooses — and logs an accurate reason for each.cargo auditkeeps running (it only talks to the trusted RustSec database), but from a fresh, empty directory with--file <repo>/Cargo.lock. The repository'saudit.tomlis out of reach: no redirect, no silenced advisories. Verified with a planted config: default database,"ignore": [].needed_generators) plus an executor, so the gate is testable without spawning anything.uv.lockas a lockfile, so with the opt-in on it re-resolved a uv project and wrote a freshrequirements.txtbeside the pinned lock — the same shape as the Bun bug in #331. The npm and pip lockfile lists are now shared constants used everywhere.What customers see
A manifest without a lockfile already records a skipped
sbom_dependenciesstage naming the file to commit (#331).docs/guide/scanning.mdnow lists the resolver stages, says commit your lockfile, and explains thecargo auditisolation;.env.exampleis updated to match.Nightly
js-no-lockfileno longer resolves a lockfile: its SBOM is empty and it recordssbom_dependenciesas skipped, likepy-bare-pyproject. It also no longer touches the network. No other baseline changes.Tests
the_default_policy_resolves_nothing: a tree withCargo.toml,package.json(with a URL dependency to 127.0.0.1) andpyproject.toml; under the default policy no lockfile appears.a_generator_is_needed_only_where_nothing_pins_the_ecosystem, including uv, bun and pnpm locked projects.audit_runs_outside_the_repository: working directory, arguments, cleanup.the_resolution_skip_reason_says_why_it_is_not_code_execution.🤖 Generated with Claude Code
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p