Repository navigation
api-proxy: bind cloud OIDC credentials to the configured upstream - #12000
Conversation
Azure/AWS/GCP workload identity credentials are now initialized only by adapters whose upstream is explicitly configured (COPILOT_API_TARGET, OPENAI_API_TARGET or the Azure BYOK provider URL, ANTHROPIC_API_TARGET, or the Gemini/Vertex adapters for GCP). Adapters left at their default upstream no longer pick up the global cloud OIDC configuration, and the sidecar refuses to bind these credentials to first-party OpenAI, Anthropic and GitHub Copilot hosts. The Azure branch in resolveCloudOidcProviders is now explicit so it only runs for AWF_AUTH_PROVIDER=azure (or unset). Co-authored-by: Copilot App <[email protected]>
Documentation PreviewDocumentation has been built for this PR. To view locally:
Built from commit f7be9eb |
There was a problem hiding this comment.
🟡 Changes recommended
Cloud OIDC tokens and inherited Azure BYOK keys can be sent to unrelated upstreams because credential selection is not correctly bound to the effective target.
4 open issues
What changed in this PR
This PR narrows cloud OIDC credential use in AWF’s API proxy, aiming to prevent default provider adapters from receiving BYOK gateway credentials or triggering unwanted startup discovery.
Changes:
- Adds per-adapter cloud OIDC opt-in, upstream checks, and refusal logging.
- Updates adapter binding rules while preserving native OpenAI and Anthropic workload identity paths.
- Adds binding regression tests, updates credential fixtures, and documents the new behavior.
| File | Description |
|---|---|
docs/api-proxy-sidecar.md |
Documents cloud OIDC target binding. |
containers/api-proxy/server.custom-auth-header.test.js |
Adds explicit Azure targets to header tests. |
containers/api-proxy/server.auth-matrix.test.js |
Adds default-target and first-party-host binding tests. |
containers/api-proxy/routing-catalogue.test.js |
Configures an explicit target for OIDC catalogue tests. |
containers/api-proxy/providers/openai.js |
Enables cloud OIDC for explicit or Azure BYOK targets. |
containers/api-proxy/providers/google-adapter.js |
Enables cloud OIDC for Google adapters in GCP mode. |
containers/api-proxy/providers/copilot.js |
Requires an explicit target for cloud OIDC. |
containers/api-proxy/providers/cloud-oidc-init.test.js |
Tests opt-in requirements and host refusals. |
containers/api-proxy/providers/cloud-oidc-init.js |
Enforces binding checks and explicit Azure selection. |
containers/api-proxy/providers/anthropic.js |
Enables cloud OIDC for explicitly configured targets. |
containers/api-proxy/oidc-token-provider.test.js |
Updates Azure OIDC fixtures with explicit targets. |
containers/api-proxy/copilot-adapter-enterprise.test.js |
Updates Copilot OIDC fixtures with gateway targets. |
containers/api-proxy/aws-oidc-token-provider.test.js |
Adds explicit targets to AWS/GCP adapter fixtures. |
containers/api-proxy/adapter-factory.js |
Supplies target and adapter identity to OIDC resolution. |
Review effort: Max (adaptive)
| if (authType === 'github-oidc' && !skipWhen && CLOUD_OIDC_PROVIDERS.has(authProvider)) { | ||
| if (!allowCloudOidc) { |
| allowOpenAiWif: openAiWifRequested, | ||
| // Cloud OIDC tokens are only bound to an explicitly configured upstream | ||
| // (OPENAI_API_TARGET or the Azure BYOK provider URL), never the default. | ||
| allowCloudOidc: !!(env[OPENAI_ENV.TARGET] || (copilotAzureByokEnabled && copilotByokTarget)), |
| const provider = injectOidcToken(adapter, 'entra-token'); | ||
| expect(adapter.getAuthHeaders(fakeReq()).Authorization).toBe('Bearer entra-token'); | ||
| provider.shutdown(); | ||
| }); |
|
@copilot address review feedback |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
|
✅ Copilot review passed with no inline comments. @lpcox Add the |
|
🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅
|
|
🔌 Smoke Services — All services reachable! ✅ Warning Threat detection engine error Threat detection could not complete its analysis due to a tooling error. This is not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs to troubleshoot the error.
|
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅
|
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 Warning Threat detection engine error Threat detection could not complete its analysis due to a tooling error. This is not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs to troubleshoot the error.
|
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤
|
|
✅ Security Guard completed successfully! Security GuardOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Smoke Claude passed
|
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. Smoke ChrootOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
Smoke Cloud Hypervisor completed. Cloud Hypervisor + Copilot passed.
|
|
✅ Build Test Suite completed successfully! Warning Threat detection engine error Threat detection could not complete its analysis due to a tooling error. This is not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs to troubleshoot the error. Build Test SuiteOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose. 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
- "169.254.169.254"See Network Configuration for more information.
|
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 Smoke CodexOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
Smoke Test: Claude Engine Validation
Overall result: PASS
|
Smoke Test
|
|
Cloud Hypervisor + Copilot smoke test
Overall: PASS
|
|
Smoke Test: Copilot Engine (PR #12000, author @lpcox, assignees: none)
Recent merged PRs: #11992 (wildcard blocklist deny test pin), #11977 (auth docs fix) Overall: PASS
|
Smoke Test: Copilot Network Isolation ✅Result: PASS
The firewall correctly permits allowlisted domains and blocks non-allowlisted domains.
|
|
Warning Threat detection engine error Threat detection could not complete its analysis due to a tooling error. This is not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs to troubleshoot the error. Smoke Test: Copilot BYOK (Direct Mode) ✅Results:
Status: PASS — Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy sidecar. /cc @lpcox
|
📡 OTel tracing smoke test: PR #12000
Filed an issue for items 2 and 5. Docker image build was not re-run locally (Docker-in-Docker is unsupported here).
|
Chroot Version Comparison
Result: FAILED ( The Node.js mismatch needs investigation.
|
|
Warning Threat detection engine error Threat detection could not complete its analysis due to a tooling error. This is not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs to troubleshoot the error. Services smoke test: ✅ Redis PONG, ✅ pg_isready accepting connections, ✅ SELECT 1 = 1. PASS
|
|
Warning Threat detection engine error Threat detection could not complete its analysis due to a tooling error. This is not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs to troubleshoot the error. 🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — PASS Environment workarounds (test code unchanged; TLS verification stayed on):
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
- "169.254.169.254"See Network Configuration for more information.
|


Summary
When
AWF_AUTH_TYPE=github-oidcis used with a cloud provider (AWF_AUTH_PROVIDER=azure|aws|gcp), every adapter resolved the same global OIDC configuration. That included adapters whose upstream was left at its default (api.openai.com,api.anthropic.com, the derived GitHub Copilot host). In BYOK setups, those adapters attached a credential meant for the BYOK gateway and also became "enabled", so startup discovery contacted providers the workflow never configured.This PR binds cloud OIDC credentials to the upstream they were configured for.
Changes
providers/cloud-oidc-init.jsallowCloudOidcoption, and they are checked against the adapter'stargetHost.isCloudOidcTargetAllowed()rejects first-party hosts (api.openai.com,api.anthropic.com,*.githubcopilot.com,copilot-api.*.ghe.com) and empty or unparseable targets. Refusals are logged (cloud_oidc_not_bound/cloud_oidc_target_refused).authProvider === 'azure'). It no longer acts as the fallback for other providers such asanthropic, oropenaiwithout WIF enabled.adapter-factory.jspassestargetHost/adapterNameautomatically.OPENAI_API_TARGETor the Azure BYOK provider URL.ANTHROPIC_API_TARGET.COPILOT_API_TARGET, which the CLI already sets fromCOPILOT_PROVIDER_BASE_URL.AWF_AUTH_PROVIDER=gcp.openai) and Anthropic WIF (anthropic) are unchanged.docs/api-proxy-sidecar.md.Compatibility
The CLI already sets
COPILOT_API_TARGET(andOPENAI_API_TARGETforCOPILOT_PROVIDER_TYPE=azure) from the BYOK provider URL, so supported BYOK + cloud OIDC configurations keep working. Tests that built adapters with cloud OIDC and no explicit target now set the target, matching what the CLI produces.Tests
isCloudOidcTargetAllowedand target-binding unit tests inproviders/cloud-oidc-init.test.js.Auth Matrix — cloud OIDC target bindingsuite covering Azure, AWS and GCP across the OpenAI, Anthropic and Copilot adapters (default targets and explicit first-party targets), plus a positive case for an explicitly configured gateway. These fail onmainand pass with this change.cd containers/api-proxy && npm test: 177/180 suites pass. The 3 remaining suites (catalogue-proxy,model-information-contract,protocol-compatibility.packaging) need root-level dependencies (ajv,typescript) that were not installed locally. They are unrelated to this change.