Extract shared auth-header builder for OpenAI and Copilot provider adapters - #8226
Conversation
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
There was a problem hiding this comment.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Note
This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.
There was a problem hiding this comment.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Note
This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.
There was a problem hiding this comment.
🟡 Changes recommended
Remove the accidental temporary file and correct the helper’s misleading prefix documentation.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 4/5 changed files
- Comments generated: 1
- Review effort level: Balanced
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
✅ Copilot review passed with no inline comments. @copilot Add the |
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
|
📰 DEVELOPING STORY: Smoke Docker Sbx reports failed. Our correspondents are investigating the incident...
|
|
🔌 Smoke Services — All services reachable! ✅
|
|
❌ Smoke Claude failed Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "api.anthropic.com"See Network Configuration for more information.
|
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅
|
|
✅ Contribution Check completed successfully! PR #8226 follows the applicable contribution guidelines in CONTRIBUTING.md. The change adds focused tests for the new helper, keeps files in the correct directories, and the PR description clearly explains the extraction and links the related issue.
|
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.
|
|
✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓
|
|
❌ Smoke Gemini reports failed. Facets need polishing...
|
|
✅ Build Test Suite completed successfully!
|
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓
|
|
🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...
|
|
✅ Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓
|
|
🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅ Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "example.com"See Network Configuration for more information.
|
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤
|
|
✅ Security Guard completed successfully! Security review of PR #8226 complete: Extract shared auth-header builder for OpenAI and Copilot provider adapters. Changes are refactoring-only (consolidating duplicated auth header logic into buildAuthHeaderFn). No security-weakening changes detected: no expanded ACLs, no weakened validation, no secrets exposure, no capability additions, no firewall chain changes. Passes security review.
|
Smoke Test: Services Connectivity
Overall: FAIL —
|
Smoke Test: API Proxy OTEL Tracing — Results
Overall: All 5 scenarios pass. No unexpected failures detected.
|
|
EGRESS_RESULT allow=pass deny=pass ✅ allowed domain (api.github.com) reachable — HTTP 200 Overall status: PASS
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "example.com"See Network Configuration for more information.
|
Smoke Test: Copilot BYOK (Direct) Mode✅ GitHub MCP Testing — Verified connectivity to github/gh-aw-firewall (2 merged PRs listed) Status: PASS Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) with inference routed through api-proxy sidecar to api.githubcopilot.com.
|
|
Smoke Test: Copilot Engine —
Recent PRs:
Overall: PASS
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — PASS Notes:
|
|
MCP tool connectivity: ❌
|
|
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
|
Chroot Version Comparison Results
|
copilot.jsandopenai.jseach reimplemented the same "custom header name vs.Authorizationprefix" branching for credential injection, making security-sensitive auth logic harder to keep consistent across providers.Shared helper
buildAuthHeaderFn({ headerName, prefix })tocontainers/api-proxy/providers/auth-headers.js. Given aheaderNameit builds aproviderKeyHeaders-style header (e.g. Azure BYOK'sapi-key); otherwise it falls back totokenAuthHeaderswith a configurableprefix(defaultBearer), covering Copilot'stoken/Bearersplit.Adapter updates
openai.js: replaced the inlinecustomAuthHeader ? providerKeyHeaders(...) : bearerAuthHeaders(...)branch withbuildAuthHeaderFn({ headerName: customAuthHeader || undefined }).copilot.js: replaced thetokenAuthHeaders(authPrefix, authToken, ...)call inbuildStaticHeaderswithbuildAuthHeaderFn({ prefix: authPrefix })(...).Tests
auth-headers.test.jscovering default prefix, custom prefix, header-name mode, and extra-header merging for both modes.No behavior change intended — this is a pure extraction of existing branching into one reusable, testable helper.