Skip to content

fix(utils): normalize trailing-dot/case in code-hosting host matching#2749

Open
r266-tech wants to merge 1 commit into
volcengine:mainfrom
r266-tech:fix/code-hosting-host-normalization
Open

fix(utils): normalize trailing-dot/case in code-hosting host matching#2749
r266-tech wants to merge 1 commit into
volcengine:mainfrom
r266-tech:fix/code-hosting-host-normalization

Conversation

@r266-tech

Copy link
Copy Markdown
Contributor

code_hosting_utils host matching lowercased hosts but did not strip the trailing root dot, and the git@ branches compared the raw host against un-normalized config domains. So a valid trailing-dot FQDN (github.com.) or an uppercase entry in github_domains was silently not recognized as a code-hosting URL, mis-routing the accessor.

network_guard._normalize_host already canonicalizes hosts with rstrip(".").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 in code_hosting_utils (_domain_matches, _extract_host, both git@ branches, and the is_github_url / is_gitlab_url / is_git_repo_url config-domain checks).

Normalization only widens matching to the correct canonical host; valid matches are unaffected. Adds regression tests.

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

2689 - Fully compliant

Compliant requirements:

  • (This PR applies similar normalization to code-hosting URL host matching, which is consistent with the ticket's intent for host normalization)
⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🏅 Score: 95
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown

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.
@r266-tech r266-tech force-pushed the fix/code-hosting-host-normalization branch from 17f16bc to 1b21b0d Compare June 20, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant