feat(security): stop executing code from scanned repositories (#257) (#296)
CI / Check (push) Skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Agent (push) Successful in 4m54s
CI / Deploy Docs (push) Successful in 1m7s
CI / Deploy Dashboard (push) Successful in 3m57s
CI / Deploy MCP (push) Successful in 2m56s

This commit was merged in pull request #296.
This commit is contained in:
sharang committed 2026-09-21 10:27:59 +00:00
1 parent cc3a9c7130
commit 06d2f458e6
17 files changed
+458 -89

No files matched your search

+28
View File
@@ -81,6 +81,34 @@ address is refused.
aimed at `10.x` PLCs on purpose, so it sets `PW_ALLOW_PRIVATE_TARGETS=1`. A
hardened cloud deployment ignores that variable — it shares a network with the
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:
| Stage | What it executes |
|---|---|
| `cargo clippy` | compiles the crate, so `build.rs` and proc macros run |
| ESLint | the repository's own `node_modules/.bin/eslint`, with JavaScript config files |
| `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.
A single-tenant or sandboxed deployment can turn them on with
`PW_ALLOW_UNTRUSTED_CODE_EXEC=1`; a hardened deployment ignores it. The stages
return later as sandboxed Werkbank jobs.
Every external tool also runs with an empty environment apart from a short
allowlist (`PATH`, `HOME`, `TMPDIR`, and its own cache variables), so the
agent's credentials are not visible to it, and it is killed when its timeout
expires.
## Deduplication and Fingerprinting