Extract OIDC/auth helpers from proxy-utils into oidc-adapter-utils#5604
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the api-proxy’s auth/OIDC-related helpers out of containers/api-proxy/proxy-utils.js into a dedicated containers/api-proxy/oidc-adapter-utils.js module, keeping security-sensitive OIDC/auth-header logic separated from general proxy utilities and ensuring the runtime image includes the new module.
Changes:
- Extracted OIDC/auth helper functions into
oidc-adapter-utils.jsand removed their exports fromproxy-utils.js. - Updated provider/adaptor callers and the focused OIDC tests to import helpers from the new module.
- Updated the api-proxy Dockerfile COPY list to include the new runtime module.
Show a summary per file
| File | Description |
|---|---|
| containers/api-proxy/oidc-adapter-utils.js | New module containing extracted OIDC/auth-header validation and runtime adapter helpers. |
| containers/api-proxy/proxy-utils.js | Removes OIDC/auth helpers to narrow this file back to general proxy utilities. |
| containers/api-proxy/proxy-utils.oidc.test.js | Updates tests to target the new oidc-adapter-utils module and adds coverage for header validation helpers. |
| containers/api-proxy/providers/openai.js | Imports validateAuthHeaderEnv from oidc-adapter-utils instead of proxy-utils. |
| containers/api-proxy/providers/anthropic.js | Imports auth/OIDC helpers from oidc-adapter-utils, leaving proxy helpers on proxy-utils. |
| containers/api-proxy/providers/copilot.js | Imports resolveOidcAuthHeaders from oidc-adapter-utils. |
| containers/api-proxy/providers/copilot-byok.js | Imports isValidHeaderName from oidc-adapter-utils. |
| containers/api-proxy/providers/cloud-oidc-init.js | Imports OIDC runtime helper functions from oidc-adapter-utils. |
| containers/api-proxy/Dockerfile | Copies oidc-adapter-utils.js into the runtime image to prevent MODULE_NOT_FOUND at runtime. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Low
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
✅ Copilot review passed with no inline comments. @copilot Add the |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
✅ Smoke Gemini completed. All facets verified. 💎 |
|
✅ Contribution Check completed successfully! Contribution check complete for PR #5604: the PR follows applicable CONTRIBUTING.md guidelines; no comment needed. |
|
✅ Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓 |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
❌ Security Guard failed. Please review the logs for details. |
|
🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅ |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. |
|
✅ Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓 |
|
🔌 Smoke Services — All services reachable! ✅ |
|
✅ Build Test Suite completed successfully! |
|
✅ Smoke Claude passed |
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
Smoke Test: Claude Engine Validation
Overall result: PASS
|
Smoke Test: Copilot PAT Auth — FAIL
Overall: FAIL — pre-step outputs missing; HTTP and file tests could not be verified. Auth mode: PAT (COPILOT_GITHUB_TOKEN) | PR author:
|
🔑 Smoke Test: Copilot BYOK (Direct Mode)✅ GitHub MCP Connectivity — Verified 2 merged PRs via MCP Status: PASS — Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy → api.githubcopilot.com Attribution:
|
🤖 Smoke Test Results — PASSPR: Extract OIDC/auth helpers from proxy-utils into oidc-adapter-utils
Overall: ✅ PASS
|
|
Smoke test summary:
|
Gemini Smoke Test Results
Overall status: FAIL Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
Smoke Test: API Proxy OpenTelemetry Tracing
All 5 scenarios pass. ✅
|
🧪 Chroot Version Comparison Results
Overall: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test: GitHub Actions Services Connectivity
Overall: FAIL AWF agent is running at
|
|
|
✅ 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) Overall: PASS
|
containers/api-proxy/proxy-utils.jshad grown past its stated role as a pure/shared proxy helper module by also carrying OIDC runtime wiring and auth-header validation. This change separates the security-sensitive OIDC/auth path into its own module so auth logic can be reviewed independently of URL, header, and body utility code.Extract OIDC/auth helpers into a dedicated module
containers/api-proxy/oidc-adapter-utils.jsisValidHeaderNamevalidateAuthHeaderEnvcreateOidcRuntimeAdapterMethodsresolveOidcAuthHeadersNarrow
proxy-utils.jsback to general proxy helpersproxy-utils.jsSplit callers along the new boundary
oidc-adapter-utils.jsproxy-utils.jsPreserve container packaging for the new runtime module
oidc-adapter-utils.jsto the api-proxy Dockerfile COPY list so the extracted module is present in the runtime imageKeep the module boundary explicit in tests
oidc-adapter-utils.jsExample of the new import split: