test(auth): pin both halves of the loopback scheme guard #5

Merged
jlxq0 merged 1 commit from test-loopback-scheme-guard into main 2026-08-25 02:27:54 +00:00
Owner

loopback_matches_ignoring_port already requires both the allowlist entry and the requested URI to use http, but no test held either half in place. This adds loopback_entry_does_not_match_a_different_requested_scheme. No behaviour change.

Both halves were verified load-bearing by mutation:

Mutation Result
if entry.scheme() != "http" { (drop the requested-URI check) test FAILED — https://localhost:3118/callback matched an http://localhost:8787/callback entry
if uri.scheme() != "http" { (drop the entry check) test FAILED — an https://localhost:8443/callback entry admitted a cleartext http://localhost:3118/callback

Before this test, the first mutation left the whole suite green. That is the hole a naive version of #2's fix has, and none of the four tests the issue specified would have caught it.

cargo fmt --all --check clean, cargo clippy --all-targets --all-features --locked -- -D warnings clean, cargo test --all-features --locked 100 passed / 0 failed.

Follow-up to #2; no release needed, v0.1.2 already carries the correct matcher.

`loopback_matches_ignoring_port` already requires **both** the allowlist entry and the requested URI to use `http`, but no test held either half in place. This adds `loopback_entry_does_not_match_a_different_requested_scheme`. No behaviour change. Both halves were verified load-bearing by mutation: | Mutation | Result | |---|---| | `if entry.scheme() != "http" {` (drop the requested-URI check) | test FAILED — `https://localhost:3118/callback` matched an `http://localhost:8787/callback` entry | | `if uri.scheme() != "http" {` (drop the entry check) | test FAILED — an `https://localhost:8443/callback` entry admitted a cleartext `http://localhost:3118/callback` | Before this test, the first mutation left the whole suite green. That is the hole a naive version of #2's fix has, and none of the four tests the issue specified would have caught it. `cargo fmt --all --check` clean, `cargo clippy --all-targets --all-features --locked -- -D warnings` clean, `cargo test --all-features --locked` 100 passed / 0 failed. Follow-up to #2; no release needed, v0.1.2 already carries the correct matcher.
test(auth): pin both halves of the loopback scheme guard
All checks were successful
CI / cargo (pull_request) Successful in 39s
CI / docker (pull_request) Successful in 48s
4a6cf391af
`loopback_matches_ignoring_port` requires the requested URI's scheme to be
`http` as well as the allowlist entry's, but nothing proved either half was
load-bearing. Removing the requested-URI check let
`https://localhost:3118/callback` match an `http://localhost:8787/callback`
entry with the suite still green; removing the entry check let an
`https://localhost:8443/callback` entry be downgraded to a cleartext
`http://localhost:3118/callback`.

No behaviour change — the guard was already correct.
jlxq0 merged commit 25d06a9fb7 into main 2026-08-25 02:27:54 +00:00
jlxq0 deleted branch test-loopback-scheme-guard 2026-08-25 02:27:54 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jlxq0/caldav-mcp!5
No description provided.