Stricter matching for github.com and ghe.com URLs#2127
Merged
SamMorrowDrums merged 1 commit intomainfrom Mar 3, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Tightens --gh-host URL classification so GitHub Enterprise Server hostnames that merely end with github.com/ghe.com (but aren’t the real domain or a subdomain) are no longer mis-detected as GitHub.com / GHEC, addressing issue #2000.
Changes:
- Refined dotcom detection to match only
github.comor*.github.com. - Refined GHEC detection to match only
ghe.comor*.ghe.com. - Added unit tests covering suffix vs subdomain cases for both
github.comandghe.com.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/utils/api.go | Makes hostname matching stricter by requiring exact-domain or subdomain matches for dotcom/GHEC detection. |
| pkg/utils/api_test.go | Adds coverage for the new matching behavior, including the regression case from #2000. |
omgitsads
approved these changes
Mar 3, 2026
SamMorrowDrums
approved these changes
Mar 3, 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.
Summary
GHES hostnames ending on github.com and ghe.com (like mycompanygithub.com) shouldn't be detected as dotcom/ghe hostnames.
Why
Fixes #2000
What changed
MCP impact
Prompts tested (tool changes only)
Security / limits
Tool renaming
deprecated_tool_aliases.goNote: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.
Lint & tests
./script/lint./script/testDocs