feat(scans): scan uploaded source archives like repositories (#325) #329

Merged
sharang merged 1 commits from feat/scan-source-archives into main 2026-09-23 07:22:06 +00:00
Owner

Closes #325. Part of #309.

Before

SAST, secret detection and the package SBOM ran only when the code artifact was a git repository. An uploaded source archive — how a customer without a git remote delivers code, and how every firmware fixture arrives — was ingested, unpacked, and then only its firmware SBOM was read. The run completed with no findings.

After

Ingest already unpacks the archive, so classify_and_store hands back where each artifact landed, and the same stages run over that tree:

  • run_pipeline keeps what is git-specific: clone, change detection, the commit watermark (an archive has no history, so every run scans what was uploaded).
  • scan_tree is the analysis both paths share.

A second, quieter bug

gitleaks detect on a directory that is not a git checkout scans zero bytes and reports "no leaks found" — it does not fail. On the new fixture, which plants two credentials:

gitleaks detect --source .   →  scanned ~0 bytes … no leaks found   (0 findings)
gitleaks dir .               →  leaks found: 2   (github-pat, slack-bot-token)

So archives would have been "scanned for secrets" and silently cleared. The scanner now picks the subcommand by what the tree is.

Nightly

A new archive-order-intake target uploads a small service as a zip and asserts the whole chain end to end:

secrets github-pat, slack-bot-token (planted, expired, made-up)
SAST subprocess-shell-true, detect-child-process, express XSS, weak hash
SBOM npm:lodash@4.17.15, npm:minimist@1.2.0, npm:order-intake@1.3.0 from the lockfile
CVE six GHSA advisories matched against them

The eleven firmware fixtures are archives too, so their baselines now carry their SAST and SBOM results — the Zephyr example produces the same SBOM as its git-based twin.

Also: DAST no longer claims to be skipped everywhere

The DAST trigger sat at the end of the shared tree scan, so every code target recorded dast skipped: feature disabled, including firmware and embedded targets the matrix plans no DAST for. It moves to the callers, which know the plan — the same misleading signal #319 removed from the no-code-artifact branch.

Verified

  • All 24 nightly targets blessed on a fresh database and compared on a second fresh one: pass, no diff.
  • cargo fmt --check, clippy with the CI flags (agent, core, mcp, dashboard server), cargo test (368 agent).

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Closes #325. Part of #309. ## Before SAST, secret detection and the package SBOM ran only when the code artifact was a **git repository**. An uploaded source archive — how a customer without a git remote delivers code, and how every firmware fixture arrives — was ingested, unpacked, and then only its firmware SBOM was read. The run completed with no findings. ## After Ingest already unpacks the archive, so `classify_and_store` hands back where each artifact landed, and the same stages run over that tree: - `run_pipeline` keeps what is git-specific: clone, change detection, the commit watermark (an archive has no history, so every run scans what was uploaded). - `scan_tree` is the analysis both paths share. ## A second, quieter bug `gitleaks detect` on a directory that is **not** a git checkout scans **zero bytes** and reports "no leaks found" — it does not fail. On the new fixture, which plants two credentials: ``` gitleaks detect --source . → scanned ~0 bytes … no leaks found (0 findings) gitleaks dir . → leaks found: 2 (github-pat, slack-bot-token) ``` So archives would have been "scanned for secrets" and silently cleared. The scanner now picks the subcommand by what the tree is. ## Nightly A new `archive-order-intake` target uploads a small service as a zip and asserts the whole chain end to end: | | | |---|---| | secrets | `github-pat`, `slack-bot-token` (planted, expired, made-up) | | SAST | `subprocess-shell-true`, `detect-child-process`, express XSS, weak hash | | SBOM | `npm:lodash@4.17.15`, `npm:minimist@1.2.0`, `npm:order-intake@1.3.0` from the lockfile | | CVE | six GHSA advisories matched against them | The eleven firmware fixtures are archives too, so their baselines now carry their SAST and SBOM results — the Zephyr example produces the same SBOM as its git-based twin. ## Also: DAST no longer claims to be skipped everywhere The DAST trigger sat at the end of the shared tree scan, so every code target recorded `dast skipped: feature disabled`, including firmware and embedded targets the matrix plans no DAST for. It moves to the callers, which know the plan — the same misleading signal #319 removed from the no-code-artifact branch. ## Verified - All 24 nightly targets blessed on a fresh database and compared on a second fresh one: pass, no diff. - `cargo fmt --check`, clippy with the CI flags (agent, core, mcp, dashboard server), `cargo test` (368 agent). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-09-22 21:26:06 +00:00
feat(scans): scan uploaded source archives like repositories (#325)
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 5m57s
07172009f0
SAST, secret detection and the package SBOM only ran on a git clone. An
uploaded archive — how a customer without a git remote delivers code, and
how every firmware fixture arrives — was ingested, unpacked, and then only
its firmware SBOM was read. The run completed with no findings.

Ingest already unpacks the archive, so `classify_and_store` now hands back
where each artifact landed and the same stages run over that tree.
`run_pipeline` keeps what is git-specific (clone, change detection, the
commit watermark); `scan_tree` is the analysis both paths share.

Secret detection needed a second fix: `gitleaks detect` on a directory
that is not a checkout scans **zero bytes** and reports no leaks. On the
fixture that plants two credentials it found none, while `gitleaks dir`
finds both. The scanner now picks by what the tree is.

The nightly gains a source-archive target that asserts the whole chain —
two secrets, semgrep findings, three npm components from the lockfile, and
six CVEs matched against them. The firmware fixtures, all archives, now
report their SAST and SBOM results too.

DAST moves out of the shared tree scan to the callers, which know the
plan. It was recorded as skipped for every code target, including firmware
and embedded ones the matrix plans no DAST for — the same misleading
signal #319 removed elsewhere.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit fe2414a3c0 into main 2026-09-23 07:22:06 +00:00
sharang deleted branch feat/scan-source-archives 2026-09-23 07:22:06 +00:00
Sign in to join this conversation.