fix(server): bound Claude Desktop apply bodies - #1272
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. This PR stays in draft until every box above is ticked. |
Summary
POST /api/claude-desktop/applythrough the shared 4 MiB management JSON reader instead of unboundedreq.text();Content-Length, and no-mutation failures.Why
The Claude Desktop apply route was the remaining management endpoint that parsed its body with
req.text(). A compressed or chunked request could bypass the management-body contract, and invalid input could set the persistent desired state to ON before the route returned 400.The route now shares the same bounded decode and 413 mapping used by other management endpoints. Invalid input is rejected before any desired-state or profile write.
Behavior and bounds
Content-Lengthis rejected before reading the body.arrayBuffer()API still materializes a body with no trustworthy length before the post-read raw-byte check. This change bounds admission, decompression, parsing, and retention; it does not replace the platform read with a streaming transport.Verification
tests/request-decompress.test.ts26/26 passed.b22e0e6d0): the same suite 26/26 passed.tests/claude-management-api.test.ts -t "Claude Desktop apply"4/4 passed.b22e0e6d0): the same focused apply set 4/4 passed.bun x tsc --noEmit: passed.bun scripts/privacy-scan.ts: passed.git diff --check: passed.--isolaterun hit an EBUSY storage-fixture cleanup, an unrelated management-auth 401 cascade, and then Bun'sInternal assertion failure. This matches the repository's documented dispatch-only Windows/storage-runtime class in Windows test suite remains dispatch-only until full suite is green #1059; no storage, auth-admission, or Worker-lifecycle file is changed here.Checklist
Draft pending upstream CI and the repository-required maintainer security review for management-boundary changes.
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.