Summary
The Copilot CLI validates the COPILOT_GITHUB_TOKEN (and GH_TOKEN/GITHUB_TOKEN) environment variable client-side before making any HTTP requests. If the token value does not match the expected GitHub PAT format, the CLI rejects it immediately with:
Error: No authentication information found.
This prevents the CLI from working in sandboxed environments that use proxy-based credential injection — a pattern where the real token is held by a proxy and the child process receives a placeholder value (e.g., openshell:resolve:env:COPILOT_GITHUB_TOKEN) that gets rewritten to the real token at the HTTP header level.
Reproduction Steps
-
Set COPILOT_GITHUB_TOKEN to any non-PAT-formatted string:
export COPILOT_GITHUB_TOKEN="placeholder-token-value"
copilot -sp "Hello"
-
The CLI immediately errors with "No authentication information found" — no HTTP request is made.
-
By contrast, setting it to a real PAT:
export COPILOT_GITHUB_TOKEN="github_pat_<valid_token>"
copilot -sp "Hello"
The CLI proceeds to make HTTP requests with Authorization: token <PAT>.
Observed Behavior
- The CLI performs client-side token format validation — it checks that the env var looks like a valid GitHub PAT before even attempting an API call.
- When validation fails, the CLI exits without making any network request.
- When validation passes, the CLI sends
Authorization: token <PAT> to api.gh.umua.top.
Expected Behavior
The CLI should accept any non-empty string as a token value from COPILOT_GITHUB_TOKEN and pass it through in HTTP requests. Server-side validation (401/403 responses) is sufficient to reject invalid tokens.
This would allow the CLI to work in environments where:
- A proxy intercepts outgoing requests and rewrites placeholder credentials with real ones
- The token is injected at the transport layer rather than the application layer
- Enterprise credential managers provide tokens in non-standard formats
Context
This was discovered while integrating the Copilot CLI with NVIDIA OpenShell sandboxed environments, which use L7 proxy credential injection to avoid exposing real secrets to child processes. The proxy TLS-terminates outgoing connections and rewrites Authorization headers containing placeholder values with real credentials before forwarding upstream.
The proxy credential injection works correctly for other tools (e.g., curl, gh, API clients) — only the Copilot CLI is affected because it validates the token format locally.
Additional Details
- The Copilot CLI uses
Authorization: token <PAT> (not Bearer) when authenticating to api.gh.umua.top
- The client-side validation appears to check the token format/structure beyond just the
github_pat_ prefix
- The
undici HTTP agent is used for requests (visible in user-agent: undici header)
Summary
The Copilot CLI validates the
COPILOT_GITHUB_TOKEN(andGH_TOKEN/GITHUB_TOKEN) environment variable client-side before making any HTTP requests. If the token value does not match the expected GitHub PAT format, the CLI rejects it immediately with:This prevents the CLI from working in sandboxed environments that use proxy-based credential injection — a pattern where the real token is held by a proxy and the child process receives a placeholder value (e.g.,
openshell:resolve:env:COPILOT_GITHUB_TOKEN) that gets rewritten to the real token at the HTTP header level.Reproduction Steps
Set
COPILOT_GITHUB_TOKENto any non-PAT-formatted string:The CLI immediately errors with "No authentication information found" — no HTTP request is made.
By contrast, setting it to a real PAT:
The CLI proceeds to make HTTP requests with
Authorization: token <PAT>.Observed Behavior
Authorization: token <PAT>toapi.gh.umua.top.Expected Behavior
The CLI should accept any non-empty string as a token value from
COPILOT_GITHUB_TOKENand pass it through in HTTP requests. Server-side validation (401/403 responses) is sufficient to reject invalid tokens.This would allow the CLI to work in environments where:
Context
This was discovered while integrating the Copilot CLI with NVIDIA OpenShell sandboxed environments, which use L7 proxy credential injection to avoid exposing real secrets to child processes. The proxy TLS-terminates outgoing connections and rewrites
Authorizationheaders containing placeholder values with real credentials before forwarding upstream.The proxy credential injection works correctly for other tools (e.g.,
curl,gh, API clients) — only the Copilot CLI is affected because it validates the token format locally.Additional Details
Authorization: token <PAT>(notBearer) when authenticating toapi.gh.umua.topgithub_pat_prefixundiciHTTP agent is used for requests (visible inuser-agent: undiciheader)