4 Commits

Author SHA1 Message Date
Sam Morrow 0ea1f775a7 fix: preserve authority for loopback GHES hosts
Address review: the loopback exception accepted http://localhost:3000 and
http://[::1], but newGHESHost built URLs from u.Hostname(), which drops the
port (silently retargeting the dev server to port 80) and strips IPv6 brackets
(producing an unusable URL such as http://::1/api/v3/).

Derive the base-host REST/GraphQL/upload/raw/authorization URLs from u.Host so
the port and IPv6 brackets are preserved. Subdomain-isolation URLs keep using
the bare hostname, since a label cannot be prepended to a host:port or an IP
literal. Add tests for the ::1 case and for port preservation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-08-14 13:53:02 +02:00
Sam Morrow 0c825b4233 fix(security): enforce HTTPS for gh-host/GITHUB_HOST to prevent cleartext credentials
GHES hosts accepted an http:// scheme, which was interpolated into every
REST/GraphQL/upload/raw/authorization URL. Authenticated requests would then
carry the bearer token/PAT over cleartext http, exposing it to network
interception and replay.

Add a central HTTPS check in parseAPIHost so no deployment can build
authenticated URLs over http, mirroring the existing GHEC behaviour. Permit
http only for loopback hosts (localhost, 127.0.0.1, ::1) so local development
against a dev server still works.

Closes github/copilot-mcp-core#1815

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-08-14 13:53:02 +02:00
Ksenia Bobrova b50a343da5 Gracefully handle numeric parameters passed as strings (#2130)
* Gracefully handle numeric parameters passed as strings
2026-03-04 09:01:15 +01:00
Ksenia Bobrova 3fe6bc01d3 Stricter matching for github.com and ghe.com URLs 2026-03-03 14:13:53 +01:00