mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix(copilot): resolve GHE token poisoning when GITHUB_TOKEN is set
When GITHUB_TOKEN is present in the environment (e.g. for gh CLI or GitHub Actions), two issues broke Copilot authentication against GitHub Enterprise (GHE) instances: 1. The copilot provider had no base_url_env_var, so COPILOT_API_BASE_URL was silently ignored — requests always went to public GitHub. 2. `gh auth token` (the CLI fallback) treats GITHUB_TOKEN as an override and echoes it back instead of reading from its credential store (hosts.yml). This caused the same rejected token to be used even after env var priority correctly skipped it. Fix: - Add base_url_env_var="COPILOT_API_BASE_URL" to copilot ProviderConfig - Strip GITHUB_TOKEN/GH_TOKEN from the subprocess env when calling `gh auth token` so it reads from hosts.yml - Pass --hostname from COPILOT_GH_HOST when set so gh returns the GHE-specific OAuth token
This commit is contained in:
parent
8ec1608642
commit
2a9e50c104
2 changed files with 19 additions and 2 deletions
|
|
@ -127,6 +127,7 @@ PROVIDER_REGISTRY: Dict[str, ProviderConfig] = {
|
|||
auth_type="api_key",
|
||||
inference_base_url=DEFAULT_GITHUB_MODELS_BASE_URL,
|
||||
api_key_env_vars=("COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"),
|
||||
base_url_env_var="COPILOT_API_BASE_URL",
|
||||
),
|
||||
"copilot-acp": ProviderConfig(
|
||||
id="copilot-acp",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue