fix(security): prevent SSRF via unvalidated GitHub Enterprise URL in Copilot plugin#22
Open
tejas0077 wants to merge 9308 commits into
Open
fix(security): prevent SSRF via unvalidated GitHub Enterprise URL in Copilot plugin#22tejas0077 wants to merge 9308 commits into
tejas0077 wants to merge 9308 commits into
Conversation
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.
Fixes #23
What does this PR do?
Fixes a Server-Side Request Forgery (SSRF) vulnerability in the GitHub Copilot plugin where the enterpriseUrl input was only validated for URL format but not checked against safe domain patterns.
An attacker could supply internal addresses (127.0.0.1, localhost, 192.168.x.x) or attacker-controlled domains, causing CyberStrike to make OAuth requests to unintended endpoints and forward Bearer tokens to those endpoints.
Related to CWE-918 (Server-Side Request Forgery).
Type of change
Bug fix
Security tool / MCP server / Bolt plugin
Security impact
This PR modifies authentication / authorization logic
How did you verify it works?
Manually tested with the following inputs:
localhost → rejected with "Internal or loopback addresses are not allowed"
127.0.0.1 → rejected with "Internal or loopback addresses are not allowed"
192.168.1.1 → rejected with "Internal or loopback addresses are not allowed"
company.ghe.com → accepted correctly
github.mycompany.com → accepted correctly
Reviewed the fetch call chain to confirm baseURL, DEVICE_CODE_URL, and ACCESS_TOKEN_URL are always constructed from validated domains only. Defense in depth applied at both the UI validate hook and inside authorize().
Checklist
PR is focused on a single change
No secrets, credentials, or API keys in the diff
bun turbo typecheck passes
Tested locally with at least one LLM provider
Breaking changes are documented (if any)