Repository navigation
test: verify MCP upload resource limits for alert 1038 - #73821
Conversation
Confirm exact 1 MiB fixed-length and chunked boundaries, immediate socket closure for oversized unfinished uploads, and the absolute 30-second deadline despite continued data. The production fix is already on main and the live alert is fixed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
Review: no blocking findings
The added coverage is focused and validates the byte-limit and absolute-timeout behavior without changing production code. I found no actionable correctness, security, or maintainability issue on the changed lines. Static review only; tests were not run in this review.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review to run again
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the regression-test additions covering MCP HTTP upload limits.
No open issues 🎉
What changed in this PR
Adds regression tests for the MCP HTTP upload limits introduced in #73580, protecting against recurrence of security alert 1038. Production code and authentication behavior remain unchanged.
Changes:
- Verify fixed-length and chunked JSON uploads succeed at exactly 1 MiB.
- Verify unfinished uploads exceeding the limit receive HTTP 413 and close promptly.
- Verify trickled data cannot extend the absolute 30-second deadline, timers are cleared, and valid requests still succeed after rejection.
| File | Description |
|---|---|
actions/setup/js/mcp_http_server_runner.test.cjs |
Extends upload boundary, socket closure, deadline, and post-rejection recovery coverage. |
Review effort: Balanced (auto)
🧪 Test Quality Sentinel Report✅ Test Quality Score: 97/100 — Excellent
📊 Metrics (10 tests)
Verdict
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 97/100. 0% implementation tests (threshold: 30%). All 10 tests verify behavioral contracts for MCP upload resource limits with excellent edge-case coverage. No violations detected.
🧪 Test quality analysis by Test Quality Sentinel · copilot · haiku45 · ~27 AIC · ⌖ ~9 AIC · ⊞ 9.2K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd — this is a clean, test-only PR with no actionable blockers. Approving.
📋 Key Themes & Highlights
Key Themes
- Single-file, tests-only change (65 additions / 2 deletions) adding regression coverage for security alert 1038, which already has its production fix in #73580.
- Tests exercise exact boundary conditions: 1,048,576-byte limit (both fixed-length and chunked), rejection one byte above the limit with immediate socket close (413), and the absolute (non-sliding) 30-second upload deadline enforced via fake timers across three trickled writes (408).
- Each new test confirms the server recovers and accepts a legitimate follow-up request afterward, a good signal that state isn't left corrupted by the rejection path.
- Test names read as clear specifications (it.each with descriptive chunked/not-chunked variants, explicit deadline semantics in the title) — solid /tdd naming discipline.
Positive Highlights
- ✅ Asserts the production constants directly (MAX_REQUEST_BODY_BYTES, REQUEST_BODY_TIMEOUT_MS) so the tests fail loudly if the limits are ever changed without updating expectations.
- ✅ Uses real TCP sockets with fake timers to deterministically test the exact deadline boundary (10s + 10s + 9.999s + 1ms = 30,000ms) instead of relying on flaky wall-clock sleeps.
- ✅ Verifies socket destruction, timer cleanup (vi.getTimerCount reaches 0), and logger invocation — covers the full observable contract of the timeout path, not just the status code.
Minor, non-blocking note
- Left one inline suggestion about optionally extracting a small writeChunk helper if more raw chunked-encoding tests get added later, purely for readability — does not affect correctness or block merge.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · ~47 AIC · ⌖ ~16 AIC · ⊞ 10.7K
Comment /matt to run again
| expect((await request(currentServer, { method: "POST", path: "/", body: "{}" })).statusCode).toBe(200); | ||
| }); | ||
|
|
||
| it("closes a continuously trickled upload at the absolute 30-second deadline", async () => { |
There was a problem hiding this comment.
[/codebase-design] Nice regression test for the absolute (non-sliding) 30s deadline — this is exactly the kind of edge case that prevents silent regressions on alert 1038. Minor, non-blocking: the raw-socket + manual chunked-encoding setup (socket.write(\"1\\r\\n (r/redacted)\\n\")) duplicates low-level framing logic that could be extracted into a small writeChunk(socket, data) helper if more timing-sensitive chunked tests get added later, keeping the test body focused on timing assertions rather than wire-format details.
@copilot please address this.
|
🎉 This pull request is included in a new release. Release: |
Why
Prevent regressions in the MCP HTTP upload protections associated with security alert 1038. The production fix already landed in #73580, and the live alert was confirmed fixed on November 1, 2026. This PR adds tests only, not a duplicate production fix.
Changes
The tests use real HTTP/TCP connections and fake timers for the exact deadline. Authentication behavior and the production runner are unchanged.
Validation
make fmt-cjsandmake lint-cjspassed, with existing lint warnings only.make agent-report-progresspassed, including the 30-test impacted runner suite.