Repository navigation
fix: MCP server accepts malformed IPv6 loopback hosts - #1180
Conversation
Validate the suffix after a bracketed IPv6 loopback address. Block junk and invalid ports from bypassing the MCP Host gate. Signed-off-by: Joel Fernandes <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 19, 2026, 4:03 PM ET / 20:03 UTC. ClawSweeper reviewWhat this changesThe PR validates the complete bracketed IPv6 loopback authority in local MCP Host headers and adds accepted and rejected parser cases. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 2 items remain Keep open pending real MCP listener proof. The focused parser fix addresses a current-main Host validation gap and its direct tests look sound, but the running HTTP boundary has not been demonstrated. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherThe tray's local MCP server receives loopback HTTP requests before passing JSON-RPC calls to Windows capabilities. Its request gate rejects unsafe browser and Host-header contexts before authentication and tool dispatch. flowchart LR
A[Local MCP client] --> B[Loopback HTTP listener]
B --> C[Request security gate]
C --> D{Origin and Host allowed?}
D -->|No| E[Forbidden response]
D -->|Yes| F[Bearer authentication]
F --> G[JSON-RPC tool bridge]
G --> H[Windows capabilities]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the narrow complete-authority validation with a raw listener regression and a redacted current-head HTTP or MCP transcript showing malformed rejection and valid IPv6 loopback compatibility. Do we have a high-confidence way to reproduce the issue? Yes, from source. Current main accepts an exact [::1] prefix without checking the remainder of the Host authority. Is this the best way to solve the issue? Yes. Validating the complete authority is the narrowest maintainable repair, provided it is proven through the listener boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 12b84457a464. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Fixes an issue where malformed bracketed IPv6 Host headers could pass the local MCP server's loopback Host validation when arbitrary text or an invalid port followed the closing bracket. This weakened the defensive Host-header gate intended to reject non-loopback request authorities.
Why This Change Was Made
Validate the entire bracketed IPv6 authority, accepting only [::1] or [::1]: within the 16-bit port range. The validator is internal so the existing friend test assembly can exercise this security boundary directly without adding public API surface.
User Impact
Operators can expect the local MCP endpoint to reject malformed IPv6 Host values instead of treating them as valid loopback authorities. Normal IPv4 endpoints and valid bracketed IPv6 loopback hosts remain compatible.
Evidence
Before the parser change, the focused regression run failed 4 malformed-host cases and passed 2 valid-host cases. At current head, the same focused run passes all 6 cases.
Change Type
Scope
Validation
Real Behavior Proof
Security Impact
Compatibility and Migration
Review Conversations