docs: comprehensive auth matrix documentation and tests#4794
Conversation
Add docs/auth-matrix.md documenting every authentication combination supported by the api-proxy sidecar, including: - All 4 engines (OpenAI, Anthropic, Copilot, Gemini) - Static keys, OIDC/WIF (Azure, AWS, GCP, Anthropic native) - GitHub instance types (github.com, GHEC, GHES) - BYOK modes, custom headers, credential isolation - Links to official provider documentation Add server.auth-matrix.test.js with 46 tests covering: - Every engine × auth-type × instance-type combination - GHES token vs Bearer prefix distinction - GHES + BYOK interaction (Bearer for BYOK, token for OAuth) - OIDC token injection and isEnabled gating - Custom auth header propagation - Credential isolation behavior - /models endpoint special routing Addresses #4793 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
This PR adds a single reference document that enumerates the api-proxy sidecar’s supported authentication modes across providers, and introduces a dedicated Jest suite that exercises the adapters’ auth-header behavior across those combinations to close previously identified coverage gaps.
Changes:
- Add
docs/auth-matrix.mddocumenting auth dimensions, per-provider rules, and OIDC configuration requirements. - Add
containers/api-proxy/server.auth-matrix.test.jswith comprehensive adapter-level tests for OpenAI/Anthropic/Copilot/Gemini auth header construction, including GHES and OIDC cases.
Show a summary per file
| File | Description |
|---|---|
| docs/auth-matrix.md | New auth matrix/spec document for api-proxy behavior across providers and auth modes. |
| containers/api-proxy/server.auth-matrix.test.js | New Jest suite validating adapter auth headers across documented combinations (incl. GHES and OIDC). |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 5
| ### Custom Auth Header | ||
|
|
||
| `AWF_OPENAI_AUTH_HEADER` overrides the header name used for the API key. The key is still sent as the header value (with `Bearer` prefix for non-Azure, without for Azure). | ||
|
|
| ### `/models` Endpoint (Special Case) | ||
|
|
||
| The `/models` endpoint ALWAYS uses `COPILOT_GITHUB_TOKEN` (GitHub OAuth), never a BYOK key. This is because model listing is a GitHub platform feature, not a provider feature. | ||
|
|
| | Copilot | Azure BYOK | — | ✅ | via OpenAI adapter | | ||
| | Copilot | Azure OIDC | — | ✅ | `server.auth.test.js:749+` | | ||
| | Copilot | AWS OIDC | — | ⚠️ partial | Scaffolding only | | ||
| | Copilot | GCP OIDC | — | ⚠️ partial | Scaffolding only | | ||
| | Copilot | GHES + BYOK | GHES | ⚠️ gap | Untested interaction | | ||
| | Gemini | Static key | — | ✅ | `gemini.js:25-45` | |
| JSON object of headers injected on BYOK inference requests: | ||
| - Only active when `COPILOT_PROVIDER_API_KEY` is set | ||
| - NOT injected on `/models` GET when GitHub OAuth token is available | ||
| - Protected headers silently skipped with warning | ||
|
|
| it('Copilot dummy BYOK key is used as-is at the adapter level', () => { | ||
| // The 'dummy-byok-key-for-offline-mode' placeholder is filtered at the | ||
| // credential-env layer (api-proxy-credential-env.ts), not in the adapter. | ||
| // At the adapter level it's treated as a real key. | ||
| const adapter = createCopilotAdapter({ |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@copilot fix this failing ci check https://github.com/github/gh-aw-firewall/actions/runs/27388545279/job/80940879241?pr=4794 |
Fixed in 7ed6e0e. I investigated run 27388545279/job 80940879241 and the failure was Lychee returning 403 on |
|
Smoke Test Results: Copilot BYOK (Direct Mode) ✅ MCP Connectivity — github-list_pull_requests verified Status: PASS — Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY)
|
🤖 Smoke Test: PASSPR: docs: comprehensive auth matrix documentation and tests
Overall: PASS
|
|
Smoke test summary:
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
🔥 Smoke Test Results — Auth mode: PAT (COPILOT_GITHUB_TOKEN)PR: docs: comprehensive auth matrix documentation and tests (@lpcox)
Overall: PASS
|
🔭 Smoke Test: API Proxy OpenTelemetry Tracing
All scenarios passed. Module auto-initializes on load (
|
This comment has been minimized.
This comment has been minimized.
Chroot Runtime Version Comparison
Result: Not all tests passed. Go matches, but Python and Node.js versions differ between host and chroot.
|
|
@lpcox
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test: GitHub Actions Services Connectivity
Overall: FAIL —
|
|
GitHub API: ✅ PASS Total: PASS
|
|
@lpcox
|
Summary
Adds comprehensive documentation and test coverage for every authentication combination supported by the api-proxy sidecar.
New files
docs/auth-matrix.md— Full specification of all auth dimensions with:containers/api-proxy/server.auth-matrix.test.js— 46 tests covering:x-api-key→Authorization: Bearer), custom headersKey gaps now tested that weren't before
tokenprefix — explicit test that GHES usestoken(notBearer) for GitHub OAuthBearereven on GHES/modelson GHES in BYOK mode — falls back to GitHub token withtokenprefixAddresses #4793