fix(utils): normalize trailing-dot/case in code-hosting host matching#2749
Open
r266-tech wants to merge 1 commit into
Open
fix(utils): normalize trailing-dot/case in code-hosting host matching#2749r266-tech wants to merge 1 commit into
r266-tech wants to merge 1 commit into
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
code_hosting_utils lowercased hosts but did not strip the trailing root
dot, and the git@ branches compared the raw host against un-normalized
config domains. A valid trailing-dot FQDN (github.com.) or an uppercase
github_domains entry was therefore silently not recognized as a code-
hosting URL, mis-routing the accessor.
Apply network_guard._normalize_host's rstrip('.').lower() canonicalization
symmetrically across every host<->domain comparison (consistency with the
just-merged volcengine#2689 Feishu host-match hardening). Normalization only widens
matching to the correct canonical host; valid matches are unaffected.
Adds regression tests.
17f16bc to
1b21b0d
Compare
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.
code_hosting_utilshost matching lowercased hosts but did not strip the trailing root dot, and thegit@branches compared the raw host against un-normalized config domains. So a valid trailing-dot FQDN (github.com.) or an uppercase entry ingithub_domainswas silently not recognized as a code-hosting URL, mis-routing the accessor.network_guard._normalize_hostalready canonicalizes hosts withrstrip(".").lower()(applied to both the host and the allowlist), and #2689 just hardened the same host-match class for Feishu. This applies the same normalization symmetrically across every host↔domain comparison incode_hosting_utils(_domain_matches,_extract_host, bothgit@branches, and theis_github_url/is_gitlab_url/is_git_repo_urlconfig-domain checks).Normalization only widens matching to the correct canonical host; valid matches are unaffected. Adds regression tests.