MVP-0.5 · Resource control: scan semaphore, streamed uploads, zip-bomb caps, query limits #258

Closed
opened 2026-09-20 20:16:04 +00:00 by sharang · 0 comments
Owner

Goal

The production node is small (8 GB) and several code paths are unbounded: scans start from onboarding, webhooks and the scheduler with no concurrency limit, uploads are buffered in memory, archives are unpacked without caps, and list endpoints accept arbitrary limit, sort_by and regex input. This makes the node both easy to exhaust and, via sort_by, injectable.

What to change

  • A global scan semaphore (SCAN_CONCURRENCY) plus a per-target lock covering every tokio::spawn scan entry point: onboarding, webhooks and the scheduler.
  • Stream uploads to disk (handlers/onboarding.rs:436,462); the dashboard stops proxying uploads as a Vec<u8> server function.
  • Zip-bomb caps on unpacking (ingest/blob.rs:76-101).
  • Clamp limit/page, allowlist sort_by and escape regex input — #64 (findings.rs:34,48-53, sbom.rs:82, dto.rs).
  • Pagination and streaming for #62, #63, #66, #67.

Acceptance

  • Concurrent scan starts above SCAN_CONCURRENCY queue rather than run; a second scan of the same target does not run twice in parallel.
  • A large artifact upload completes without the agent or the dashboard holding it in memory.
  • A zip bomb is rejected by the uncompressed-size and entry-count caps, with a test fixture.
  • sort_by accepts only allowlisted fields; regex input is escaped; limit/page are clamped (#64 closed).
  • #62, #63, #66 and #67 are closed by paginated or streamed implementations with tests.
## Goal The production node is small (8 GB) and several code paths are unbounded: scans start from onboarding, webhooks and the scheduler with no concurrency limit, uploads are buffered in memory, archives are unpacked without caps, and list endpoints accept arbitrary `limit`, `sort_by` and regex input. This makes the node both easy to exhaust and, via `sort_by`, injectable. ## What to change - A global scan semaphore (`SCAN_CONCURRENCY`) plus a per-target lock covering every `tokio::spawn` scan entry point: onboarding, webhooks and the scheduler. - Stream uploads to disk (`handlers/onboarding.rs:436,462`); the dashboard stops proxying uploads as a `Vec<u8>` server function. - Zip-bomb caps on unpacking (`ingest/blob.rs:76-101`). - Clamp `limit`/`page`, allowlist `sort_by` and escape regex input — **#64** (`findings.rs:34,48-53`, `sbom.rs:82`, `dto.rs`). - Pagination and streaming for **#62**, **#63**, **#66**, **#67**. ## Acceptance - [ ] Concurrent scan starts above `SCAN_CONCURRENCY` queue rather than run; a second scan of the same target does not run twice in parallel. - [ ] A large artifact upload completes without the agent or the dashboard holding it in memory. - [ ] A zip bomb is rejected by the uncompressed-size and entry-count caps, with a test fixture. - [ ] `sort_by` accepts only allowlisted fields; regex input is escaped; `limit`/`page` are clamped (#64 closed). - [ ] #62, #63, #66 and #67 are closed by paginated or streamed implementations with tests.
sharang added this to the Production MVP milestone 2026-09-20 20:16:04 +00:00
sharang added the performancehighsecurity labels 2026-09-20 20:16:04 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#258