Files
pruefwerk/Cargo.toml
T
Sharang ParnerkarandClaude Opus 5 3a4919f0f6
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 7m9s
feat(security): stream uploads end to end, bound request bodies (#258)
The second half of #258. A file upload of up to 512 MiB used to be held in
memory about five times over: the browser read it into WASM memory, sent it to
the dashboard as a JSON byte array inside a server function (roughly 4x the
file), the dashboard copied it into a multipart request, and the agent buffered
the whole field before writing it. Several concurrent uploads could exhaust an
8 GB node.

Now nothing holds the file:

- Browser: the wizard keeps the picked file's handle, not its bytes, and passes
  it as a Dioxus `FileStream`, which sends the `File` itself as the request body
  (browser-native streaming from disk).
- Dashboard: `POST /api/uploads/{id}?kind&plc_format` forwards that body to the
  agent as the multipart `file` part via `reqwest::Body::wrap_stream`.
- Agent: the `file` field is written to disk chunk by chunk, refused with 413
  past 512 MiB, and owned by a guard that deletes it on any early return — an
  oversized, malformed or kind-less upload leaves nothing behind.

Request bodies: the 512 MiB limit applied to every route on both services, so
any JSON endpoint could be made to buffer half a gigabyte. It is now scoped:
the upload route (streamed) and the runner's job-result route (32 MiB) on the
agent, the webhook proxy (25 MB, GitHub's cap) on the dashboard; everything
else keeps axum's 2 MiB default.

Also fixes the two `manual_checked_ops` lints in `attack_chain/view.rs` that
newer clippy reports, so dashboard clippy runs clean locally.

Verified end to end in a real browser (agent + dashboard + Chromium): a 3 MiB
firmware image went through the wizard as `application/octet-stream` with no
JSON encoding and landed on disk byte-identical (SHA-256 match).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
2026-09-21 13:18:36 +02:00

42 lines
1.2 KiB
TOML

[workspace]
members = [
"compliance-core",
"compliance-agent",
"compliance-dashboard",
"compliance-graph",
"compliance-dast",
"compliance-mcp",
"compliance-smoke",
"werkbank-exec",
"control-map",
]
resolver = "2"
[workspace.lints.clippy]
unwrap_used = "deny"
expect_used = "deny"
[workspace.dependencies]
compliance-core = { path = "compliance-core", default-features = false }
control-map = { path = "control-map" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["full"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
chrono = { version = "0.4", features = ["serde"] }
mongodb = { version = "3", features = ["rustls-tls", "compat-3-0-0"] }
reqwest = { version = "0.12", features = ["json", "rustls-tls", "multipart", "cookies", "stream"], default-features = false }
thiserror = "2"
sha2 = "0.10"
hex = "0.4"
uuid = { version = "1", features = ["v4", "v5", "serde"] }
secrecy = { version = "0.10", features = ["serde"] }
regex = "1"
zip = { version = "2", features = ["aes-crypto", "deflate"] }
dashmap = "6"
tokio-stream = { version = "0.1", features = ["sync"] }
aes-gcm = "0.10"
rand = "0.9"
base64 = "0.22"