test(oauth): pin the https redirect port #9
No reviewers
Labels
No labels
waiting-on-julian
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jlxq0/jmap-mcp!9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "oauth-loopback-port"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The RFC 8252 §7.3 port carve-out shipped in
c9f5ae1(2026-08-19), before thisissue was filed, and is live in
v0.2.14. What was missing was the test holdingthe other half of the rule: the port relaxation is loopback-only.
Mutation testing showed the gap. Rewriting
loopback_redirect_matchesto compareonly scheme + host + path — relaxing the port on every scheme, including
https://claude.ai/…— leftallowlist_matches_exact_redirect_uri_onlygreen.The only test that noticed was the private-use-scheme one, and only incidentally.
This PR adds the fourth assertion from the issue: an allowlisted
https://claude.ai/api/mcp/auth_callbackstill rejectshttps://claude.ai:8443/api/mcp/auth_callback. Under that mutation it is now thetest that goes red.
Verification
Three mutations, each watched red before trusting the suite:
loopback_allowlist_varies_only_the_portallowlist_accepts_private_use_schemes,loopback_allowlist_varies_only_the_portallowlist_matches_exact_redirect_uri_only(new assertion)Live probe against
jmap-mcp.kampong.socialrunningv0.2.14:http://localhost:3118/callback(the issue's exact failing case) →201http://evil.example/callback→400 unregistered redirect_urihttps://claude.ai:8443/api/mcp/auth_callback→400 unregistered redirect_uriURL-normalisation probe:
127.1,0177.0.0.1and/x/../cbare accepted becausethe parser canonicalises them to the same effective loopback host and path;
127.0.0.2,[::ffff:127.0.0.1]and/%63bare rejected.Gates:
cargo fmt --all --checkclean,cargo clippy --all-targets --all-features --locked -- -D warningsclean,cargo test --all-features --locked164 passed.Cross-engine review by Codex (read-only) on whether the relaxed branch can admit a
non-loopback host or a different path: no. Non-
httpURIs never reach it; theytake the raw-string equality path.
No release tag follows — this is test-only and the behaviour is already in production.
Closes #8