fix(sbom): stop resolving tenant manifests in shared deployments (#330)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 5m59s

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
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-09-23 10:53:25 +02:00
1 parent 44a48957c1
commit 5a184583de
9 files changed
+282 -136

No files matched your search

+31 -8
View File
@@ -101,8 +101,9 @@ platform's own services.
## What the scanner runs on your code
Nearly every stage only *reads* your code: Semgrep, gitleaks, Syft, Ruff and the
PLC parser parse files and never execute them. Four stages are different, because
the tool has to run the project to do its job:
PLC parser parse files and never execute them, and they connect nowhere your
repository chooses. Two kinds of stage are different. Four have to run the
project to do their job:
| Stage | What it executes |
|---|---|
@@ -111,12 +112,34 @@ the tool has to run the project to do its job:
| `pip-compile` | builds source distributions to read their metadata, running `setup.py` |
| Firmware reproducible build | the project's build system, through Nix |
In a shared deployment those stages are **off**: the scanner holds many
tenants' data, and a lint warning is worth less than the blast radius of
running a stranger's build. Lockfile-based dependency resolution still happens —
npm runs with `--ignore-scripts`, and `cargo generate-lockfile` and
`cargo metadata` resolve without compiling — so your SBOM is unaffected. For a
complete firmware SBOM, build with Firmwerk on your side and import the bundle.
Three more run nothing of yours, but fetch from whatever hosts your manifests
name — a registry in a committed `.npmrc`, a URL dependency in `package.json`,
a git dependency in `Cargo.toml`:
| Stage | What it fetches |
|---|---|
| `npm install --package-lock-only` | every dependency `package.json` names, to write a missing lockfile |
| `cargo generate-lockfile` | every dependency `Cargo.toml` names, to write a missing `Cargo.lock` |
| `cargo metadata` | every dependency's sources, to read its licence |
In a shared deployment all of these stages are **off**: the scanner holds many
tenants' data, and a lint warning or a generated lockfile is worth less than the
blast radius of running a stranger's build or connecting where a stranger
chooses.
**Commit your lockfile.** The SBOM is built from `package-lock.json`,
`yarn.lock`, `pnpm-lock.yaml`, `bun.lock`, `Cargo.lock`, `requirements.txt`,
`poetry.lock`, `Pipfile.lock` or `uv.lock`. A manifest without one gets no
dependency versions, and the scan run records a skipped `sbom_dependencies`
stage naming the file to commit. Bun's binary `bun.lockb` cannot be read;
commit the text `bun.lock` (`bun install --save-text-lockfile`).
`cargo audit` still runs over a committed `Cargo.lock`. It reads configuration
from the directory it runs in, so it runs from an empty one: a committed
`.cargo/audit.toml` can neither point it at another advisory database nor
silence advisories.
For a complete firmware SBOM, build with Firmwerk on your side and import the bundle.
A single-tenant or sandboxed deployment can turn them on with
`PW_ALLOW_UNTRUSTED_CODE_EXEC=1`; a hardened deployment ignores it. The stages