fix(codex): guard loopback WS classification with isIP to prevent DNS hostname bypass#110692
fix(codex): guard loopback WS classification with isIP to prevent DNS hostname bypass#110692lsr911 wants to merge 1 commit into
Conversation
… hostname bypass
The remote-auth boundary in assertCodexAppServerConnectionSecurity uses
isLoopbackWebSocketUrl to classify WS transports as local-loopback
(auth-free) vs remote (requires authToken/Authorization). Before this
fix, host.startsWith("127.") matched DNS hostnames like 127.evil.com,
letting a remote WebSocket endpoint skip authentication entirely.
Add isIP(host)===4 guard so only literal IPv4 loopback addresses qualify.
Same canonical pattern as extensions/slack/src/monitor/relay-source.ts:271.
Co-Authored-By: Claude <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed July 18, 2026, 8:35 AM ET / 12:35 UTC. Summary PR surface: Source +4, Tests +110. Total +114 across 2 files. Reproducibility: yes. from source, with medium confidence: current-main Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Verify the exact sibling Codex app-server endpoint and authentication contract, then land the literal-IP-only classification with the focused regression tests if remote non-literal WebSocket URLs are required to authenticate. Do we have a high-confidence way to reproduce the issue? Yes from source, with medium confidence: current-main Is this the best way to solve the issue? Likely yes: using Node's built-in IP parser at the existing classifier is the narrowest way to distinguish literal IPv4 loopback from DNS names. A final best-fix judgment requires the repository-mandated direct sibling Codex source check. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against af2662f25a85. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +4, Tests +110. Total +114 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Problem
The remote-auth boundary in
assertCodexAppServerConnectionSecurityusesisLoopbackWebSocketUrlto classify WS transports aslocal-loopback(auth-free) vsremote(requires authToken/Authorization). Before this fix,host.startsWith("127.")matched DNS hostnames likews://127.evil.com/app, letting a remote WebSocket endpoint skip authentication entirely.Fix
Add
isIP(host) === 4guard so only literal IPv4 loopback addresses qualify. Same canonical pattern asextensions/slack/src/monitor/relay-source.ts:271.ws://127.0.0.1:3333/appws://127.255.255.254/codexwss://127.evil.com/appwss://127.example.com/codexEvidence
Focused regression tests (6/6):
oxfmt, oxlint, tsgo extensions prod+test types all pass.
Real behavior proof — production module, no mocks: