Skip to content
This repository was archived by the owner on May 20, 2026. It is now read-only.

Security: Overly permissive GitHub remote detection via prefix match - #5055

Open
tuanaiseo wants to merge 1 commit into
microsoft:mainfrom
tuanaiseo:contribai/fix/security/overly-permissive-github-remote-detectio
Open

Security: Overly permissive GitHub remote detection via prefix match#5055
tuanaiseo wants to merge 1 commit into
microsoft:mainfrom
tuanaiseo:contribai/fix/security/overly-permissive-github-remote-detectio

Conversation

@tuanaiseo

Copy link
Copy Markdown

Problem

GitHub remotes are identified using uri.authority.startsWith('github'). This can be spoofed by authorities like github.evil.example, potentially causing untrusted remotes to be treated as GitHub remotes if this check gates trust, auth behavior, or feature enablement.

Severity: medium
File: src/platform/remoteRepositories/common/utils.ts

Solution

Replace prefix matching with strict authority validation (exact host match or vetted suffix list, e.g., github.com, *.github.dev as required). Normalize case and parse host components before comparison.

Changes

  • src/platform/remoteRepositories/common/utils.ts (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

…a pref

GitHub remotes are identified using `uri.authority.startsWith('github')`. This can be spoofed by authorities like `github.evil.example`, potentially causing untrusted remotes to be treated as GitHub remotes if this check gates trust, auth behavior, or feature enablement.

Affected files: utils.ts

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
@alexdima

Copy link
Copy Markdown
Member

Thanks for the contribution! This repository has been archived because the project has moved into the main VS Code repository.

Could you please reopen/recreate this PR against:
https://github.com/microsoft/vscode/tree/main/extensions/copilot

We’ll continue reviewing contributions there. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants