Repository navigation
fix(core): match see_also URLs with an uppercase scheme - #438
Merged
Merged
Conversation
see_also_local_id stripped the scheme case-sensitively before lowercasing, so an uppercase scheme (HTTP://...) survived the strip and the host prefix never matched. A see_also link to a hidden bug written that way was served unscrubbed, disclosing the bug (I14). Lowercase first, then strip the scheme; same for the base-URL strip in embedded_local_ids.
plusky
approved these changes
Nov 20, 2026
plusky
left a comment
Owner
There was a problem hiding this comment.
Approve — aggregated OCR + adversarial review (single review as requested).
OCR (native, range d769b88..bf2a7d1): 0 findings, 1 file reviewed.
Adversarial pass (I14 scrub path), all verified:
- Fail-before proven locally: reverted the two closures to strip-then-lowercase with the new test entries kept —
HTTP://bugzilla.example.com/show_bug.cgi?id=7returnsNoneinstead ofSome(7), exactly the leak described. Fix restored, all 87guard::tests green. - Safe direction: both functions feed I14 id collection for scrubbing, so the change only ADDS matches for genuinely-local URLs. Lowercasing before matching is DNS-correct; path matching is unchanged (the whole value was already lowercased after the strip).
- Decision-only fold: matching runs on the lowercased copy; ids are collected, original text untouched, and
to_ascii_lowercaseis length-preserving so indices stay valid. - Degenerate base:
embedded_local_idskeeps itsbase.is_empty()early return (fail-closed);see_also_local_idwith a scheme-only base can only match a bare-path entry, which errs toward scrubbing, and such a base breaks all requests anyway. - No DESIGN update needed: no stamped claims cover strip ordering; this is a pure bug fix with a pinning test.
All 19 CI checks green. Merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An OCR audit of the repository found one guard bug.
Guard::see_also_local_idstripped the URL scheme case-sensitivelybefore lowercasing, so a
see_alsolink with an uppercase scheme(
HTTP://...) kept its scheme and the host prefix never matched. Alink to a bug the policy hides was then served unscrubbed. The same
lowercase-first ordering is applied to the base-URL strip in
embedded_local_ids, where an uppercase scheme in the configuredbase URL broke matching against embedded URLs using another scheme.
Fix: lowercase first, then strip the scheme, in both places. The
existing
see_alsotest gains the uppercase-scheme entries; it failson the old code and passes with the fix (I14).
Verification: full workspace gate green —
cargo fmt --check,cargo clippy(workspace and--features gen),cargo doc(workspace and
--features gen),cargo test --workspace --all-targets(26 test groups, 0 failures),cargo test --workspace --doc,cargo deny check.