Repository navigation
FIX: Support user:password credentials and IPv4 destinations in OpenRedirectOutputScorer (#3259) - #3260
Merged
Roman Lutz (romanlutz) merged 5 commits intoOct 18, 2026
Conversation
…edirectOutputScorer (microsoft#3259)
…edirectOutputScorer
Contributor
Author
|
Thanks for catching this, Roman Lutz (@romanlutz)! Updated in commit 7a36ae8. The regex now enforces an end-of-host boundary check and supports an optional destination port: This ensures full address validation:
|
Contributor
|
The refined boundary guard in commit 3f3b2f2 handles the host termination cleanly. Enforcing the boundary check immediately after the optional port prevents invalid octets like 192.0.2.256 from matching partial prefixes, while expanding the TLD pattern to include Punycode xn labels accommodates internationalized domain names without broadening false positives. The comprehensive test suite covers credentials, ports, IPv4 bounds, and negative email query guards nicely. |
Roman Lutz (romanlutz)
approved these changes
Oct 18, 2026
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.
Closes #3259
Description
OpenRedirectOutputScorerflags open-redirect payloads in model responses without requiring an LLM call. Its"Userinfo Host Confusion"pattern targets URLs that exploit browser authority parsing (https://trusted.com@evil.comwhereevil.comis the destination host):Per RFC 3986 § 3.2.1, the
userinfosubcomponent consists of*( unreserved / pct-encoded / sub-delims / ":" ). The previous pattern omitted:from the userinfo character set and required an alphabetical top-level domain (\.[A-Za-z]{2,}), causing two detection gaps::): URLs containing basic authentication credentials (https://user:password@evil.com) or the classic host confusion port trick (https://trusted.com:80@attacker.com,https://trusted.com:443@evil.com) failed to match.https://trusted.com@1.2.3.4orhttps://trusted.com:80@192.168.1.1) failed to match because numeric octets do not satisfy\.[A-Za-z]{2,}.This change updates
"Userinfo Host Confusion"to include:in the userinfo character set and support both fully qualified domain names and IPv4 destination addresses:redirect=//...,%2f%2f...,https://trusted.com@evil.com/login) continue to match.user@example.com), and query strings (https://example.com/login?email=user@example.com).Tests and Documentation
tests/unit/score/regex/test_open_redirect_output_scorer.py:test_open_redirect_detected:https://trusted.com:80@evil.com/login,https://trusted.com:443@evil.com/https://user:password@evil.com/path,https://admin:secret123@attacker.comhttps://trusted.com@1.2.3.4/redirect,https://trusted.com:80@192.168.1.1/testtest_open_redirect_not_detected:https://example.com/login?email=user@example.com,https://example.com/search?user=admin@123test_open_redirect_scorer_userinfo_host_confusion_rationaleasserting detection and"Userinfo Host Confusion"in score rationale.test_open_redirect_output_scorer.pypassed:uv run python -m pytest tests/unit/score/regex/test_open_redirect_output_scorer.py -v(21 passed in 8.77s)uv run python -m pytest tests/unit/score/regex/: 693 passed in 35.38sruff checkandruff format --checkclean.