The SBOM stage generates missing lockfiles so Syft can resolve a dependency tree (pipeline/sbom/mod.rs::generate_lockfiles). Both resolvers read configuration out of the scanned repository, so the repository chooses which host our scanner connects to. net_guard does not see it: the egress is a subprocess's, not ours.
npm
A committed .npmrc is honoured (NPM_CONFIG_REGISTRY is unset in the agent image, so nothing outranks it):
# .npmrc in the scanned repo
registry=http://127.0.0.1:9/
warning: spurious network error … Failed to connect to 127.0.0.1:9
error: failed to get `serde` as a dependency of package `t v0.1.0 (/repo)`
Why it matters
The scanner sits on a private network with internal services and a metadata endpoint. A tenant who uploads a repository can:
reach an internal address from inside our network and observe the result through scan timing or the error text,
point resolution at a registry they control, which then decides what our SBOM says the target depends on — a supply-chain lie in evidence a customer signs.
--ignore-scripts stops package code from running. It does not stop the fetch.
Options
Force our own configuration.npm --registry=https://registry.npmjs.org/ --userconfig /dev/null and cargo --config overrides, both of which outrank the repo's files. Cheapest, and it keeps resolution working.
Ignore repo resolver configuration. Remove .npmrc / .cargo/config.toml from the copy we resolve in, which is not the tree we scan for findings.
Gate it like pip-compile.generate_lockfiles already skips pip-compile unless PW_ALLOW_UNTRUSTED_CODE_EXEC is set; npm and cargo were left ungated. The honest fallback exists now: a manifest with no lockfile records a skipped sbom_dependencies stage naming what to commit (#310).
Egress policy at the network level, which #294 noted as the long-term answer for the whole class.
I would do (1) plus (3): force the registry for the resolvers we keep, and make the whole step opt-in the way pip-compile already is, since a customer who commits a lockfile loses nothing.
Acceptance: a repository carrying either file cannot make the scanner connect to a host of its choosing, and a test asserts it.
Found while building the #310 ecosystem fixtures.
The SBOM stage generates missing lockfiles so Syft can resolve a dependency tree (`pipeline/sbom/mod.rs::generate_lockfiles`). Both resolvers read **configuration out of the scanned repository**, so the repository chooses which host our scanner connects to. `net_guard` does not see it: the egress is a subprocess's, not ours.
## npm
A committed `.npmrc` is honoured (`NPM_CONFIG_REGISTRY` is unset in the agent image, so nothing outranks it):
```
# .npmrc in the scanned repo
registry=http://127.0.0.1:9/
```
```
npm ERR! FetchError: request to http://127.0.0.1:9/lodash failed, reason: connect ECONNREFUSED 127.0.0.1:9
```
Loopback — exactly what #294 stopped us doing in-process.
## cargo
A committed `.cargo/config.toml` replaces the registry source:
```toml
[source.crates-io]
replace-with = "evil"
[source.evil]
registry = "sparse+http://127.0.0.1:9/index/"
```
```
warning: spurious network error … Failed to connect to 127.0.0.1:9
error: failed to get `serde` as a dependency of package `t v0.1.0 (/repo)`
```
## Why it matters
The scanner sits on a private network with internal services and a metadata endpoint. A tenant who uploads a repository can:
- reach an internal address from inside our network and observe the result through scan timing or the error text,
- point resolution at a registry they control, which then decides what our SBOM says the target depends on — a supply-chain lie in evidence a customer signs.
`--ignore-scripts` stops package code from running. It does not stop the fetch.
## Options
1. **Force our own configuration.** `npm --registry=https://registry.npmjs.org/ --userconfig /dev/null` and `cargo --config` overrides, both of which outrank the repo's files. Cheapest, and it keeps resolution working.
2. **Ignore repo resolver configuration.** Remove `.npmrc` / `.cargo/config.toml` from the copy we resolve in, which is not the tree we scan for findings.
3. **Gate it like pip-compile.** `generate_lockfiles` already skips pip-compile unless `PW_ALLOW_UNTRUSTED_CODE_EXEC` is set; npm and cargo were left ungated. The honest fallback exists now: a manifest with no lockfile records a skipped `sbom_dependencies` stage naming what to commit (#310).
4. **Egress policy at the network level**, which #294 noted as the long-term answer for the whole class.
I would do (1) plus (3): force the registry for the resolvers we keep, and make the whole step opt-in the way pip-compile already is, since a customer who commits a lockfile loses nothing.
**Acceptance:** a repository carrying either file cannot make the scanner connect to a host of its choosing, and a test asserts it.
Follow-up that rules out options 1 and 2: the manifest itself names hosts, so forcing our registry configuration or removing the repository's config files does not close this.
With no .npmrc, and with the registry forced on the command line, a URL dependency in package.json is still fetched:
The same with no .cargo/config.toml, where a git dependency in Cargo.toml is fetched:
[dependencies]x={git="http://127.0.0.1:9/x.git"}
$ cargo generate-lockfile
Updating git repository `http://127.0.0.1:9/x.git`
warning: … failed to connect to 127.0.0.1: Connection refused
A resolver run over a tenant's manifest is egress to hosts the tenant chooses, by construction. Short of network-level egress policy, the only fix is not to run npm and cargo resolution in a shared deployment, as pip-compile already is not.
That costs little now. A manifest without a lockfile records a skipped sbom_dependencies stage naming the file to commit (#331), so the customer is told, not silently shortchanged.
Implementing option 3.
Follow-up that rules out options 1 and 2: **the manifest itself names hosts**, so forcing our registry configuration or removing the repository's config files does not close this.
With no `.npmrc`, and with the registry forced on the command line, a URL dependency in `package.json` is still fetched:
```json
{ "dependencies": { "x": "http://127.0.0.1:9/x-1.0.0.tgz" } }
```
```
$ npm install --package-lock-only --ignore-scripts --registry=https://registry.npmjs.org/
npm ERR! code ECONNREFUSED (it connected to 127.0.0.1:9)
```
The same with no `.cargo/config.toml`, where a git dependency in `Cargo.toml` is fetched:
```toml
[dependencies]
x = { git = "http://127.0.0.1:9/x.git" }
```
```
$ cargo generate-lockfile
Updating git repository `http://127.0.0.1:9/x.git`
warning: … failed to connect to 127.0.0.1: Connection refused
```
A resolver run over a tenant's manifest is egress to hosts the tenant chooses, **by construction**. Short of network-level egress policy, the only fix is not to run npm and cargo resolution in a shared deployment, as pip-compile already is not.
That costs little now. A manifest without a lockfile records a skipped `sbom_dependencies` stage naming the file to commit (#331), so the customer is told, not silently shortchanged.
Implementing option 3.
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.
Found while building the #310 ecosystem fixtures.
The SBOM stage generates missing lockfiles so Syft can resolve a dependency tree (
pipeline/sbom/mod.rs::generate_lockfiles). Both resolvers read configuration out of the scanned repository, so the repository chooses which host our scanner connects to.net_guarddoes not see it: the egress is a subprocess's, not ours.npm
A committed
.npmrcis honoured (NPM_CONFIG_REGISTRYis unset in the agent image, so nothing outranks it):Loopback — exactly what #294 stopped us doing in-process.
cargo
A committed
.cargo/config.tomlreplaces the registry source:Why it matters
The scanner sits on a private network with internal services and a metadata endpoint. A tenant who uploads a repository can:
--ignore-scriptsstops package code from running. It does not stop the fetch.Options
npm --registry=https://registry.npmjs.org/ --userconfig /dev/nullandcargo --configoverrides, both of which outrank the repo's files. Cheapest, and it keeps resolution working..npmrc/.cargo/config.tomlfrom the copy we resolve in, which is not the tree we scan for findings.generate_lockfilesalready skips pip-compile unlessPW_ALLOW_UNTRUSTED_CODE_EXECis set; npm and cargo were left ungated. The honest fallback exists now: a manifest with no lockfile records a skippedsbom_dependenciesstage naming what to commit (#310).I would do (1) plus (3): force the registry for the resolvers we keep, and make the whole step opt-in the way pip-compile already is, since a customer who commits a lockfile loses nothing.
Acceptance: a repository carrying either file cannot make the scanner connect to a host of its choosing, and a test asserts it.
Follow-up that rules out options 1 and 2: the manifest itself names hosts, so forcing our registry configuration or removing the repository's config files does not close this.
With no
.npmrc, and with the registry forced on the command line, a URL dependency inpackage.jsonis still fetched:The same with no
.cargo/config.toml, where a git dependency inCargo.tomlis fetched:A resolver run over a tenant's manifest is egress to hosts the tenant chooses, by construction. Short of network-level egress policy, the only fix is not to run npm and cargo resolution in a shared deployment, as pip-compile already is not.
That costs little now. A manifest without a lockfile records a skipped
sbom_dependenciesstage naming the file to commit (#331), so the customer is told, not silently shortchanged.Implementing option 3.