Repository navigation
Description
A tested implementation is available on this branch:
https://github.com/SadriG91/gh-aw/tree/fix/codex-entra-oidc
Diff against the upstream base used for the implementation:
SadriG91/gh-aw@ff73e83...8bb818a
The changes are in commit 8bb818ad. GitHub declined creation of a community PR, so this proposal follows CONTRIBUTING.md's issue-based contribution process.
Problem
A Codex workflow with engine.auth: {type: github-oidc, provider: azure} still requires CODEX_API_KEY or OPENAI_API_KEY, even though the AWF OpenAI adapter already supports exchanging GitHub OIDC assertions for Entra access tokens. Both the generated secret-validation step and codex_harness.cjs reject keyless execution; the generated provider configuration also requires CODEX_API_KEY through env_key.
Change
Enable the existing native Codex engine to use the Entra-authenticated AWF proxy:
- Suppress the primary OpenAI API-key requirement only when Azure GitHub OIDC and the AWF sandbox are enabled. Preserve MCP and other-provider credential requirements.
- Omit
env_keyfrom the managed Codex proxy configuration; retain the Responses protocol andrequires_openai_auth = false. - Emit a non-secret launch policy and require fresh AWF reflection to advertise a configured OpenAI endpoint with
auth_type: github-oidc/azurebefore starting Codex. Refuse startup if reflection or the proxy configuration is unavailable. - Apply the same behavior to inherited Codex threat detection and same-provider fallback models.
- Document Azure OpenAI and internal gateway configuration, including custom Entra scopes and federated-credential prerequisites.
Token exchange and refresh remain in the existing AWF sidecar. No Entra token is passed to Codex, no dummy API key is required, and Actions OIDC request credentials remain excluded from the agent sandbox. This introduces no Telia-specific endpoint or identity settings.
Implementation plan
The linked commit implements this plan and can be used as the starting point:
- In
pkg/workflow/codex_engine.go, makeGetRequiredSecretNames,GetSecretValidationStepandbuildCodexExecutionEnvconditional on Azure OIDC with the AWF firewall enabled. Emit the non-secretGH_AW_CODEX_OIDC_AUTH=azureruntime policy. - In
pkg/workflow/codex_config.go, omit the managed proxy'senv_keyin that mode while preserving Responses andrequires_openai_auth=false. - In
actions/setup/js/codex_harness.cjs, permit keyless startup only after fresh reflection confirms a configured OpenAI proxy usinggithub-oidc/azure. Use that reflection to configure the proxy endpoint and refuse startup if its configuration is missing. - In
pkg/workflow/engine_fallback_models.go, preserve keyless authentication for same-provider OpenAI fallbacks without suppressing unrelated providers' credentials. - Add compiler coverage in
pkg/workflow/codex_azure_oidc_test.goand runtime coverage inactions/setup/js/codex_harness.test.cjs. Cover API-key compatibility, absent or mismatched proxy authentication, detector inheritance and fallback behavior. - Update
docs/src/content/docs/reference/auth.mdxandengines.mdwith configuration and federated-credential prerequisites. Run the existing pre-PR validation gate and a live Azure OIDC pilot before release.
Expected configuration
permissions:
contents: read
id-token: write
engine:
id: codex
model: gpt-5.4
auth:
type: github-oidc
provider: azure
azure-tenant-id: ${{ vars.AZURE_TENANT_ID }}
azure-client-id: ${{ vars.AZURE_CLIENT_ID }}
audience: api://AzureADTokenExchange
azure-scope: ${{ vars.AI_GATEWAY_SCOPE }}
env:
OPENAI_BASE_URL: ${{ vars.AI_GATEWAY_BASE_URL }}
network:
allowed:
- defaults
- gateway.example.com
- login.microsoftonline.comThe Entra application already has a federated credential matching the workflow's GitHub OIDC issuer, subject and audience, and access to the target API. The custom scope supports an Entra-protected internal Responses gateway as well as Azure OpenAI's default scope. Keep the AWF agent sandbox enabled.
Validation
make buildandmake fmtpassed.make lint-cjspassed; existing warnings remain.make agent-report-progresspassed: change-scoped Go/JavaScript lint, typecheck, impacted tests, and all 337 workflows compiled with no lock-file drift.go test ./pkg/workflow -run 'TestCodex|TestFallbackModels' -count=1passed, including the new compiler, credential-isolation, detector-inheritance and fallback tests.- The Codex harness suite passed all 182 tests. A combined validation run initially hit an existing SIGTERM timing test (expected exit 1, received 143); the standalone rerun passed.
- A loopback smoke test with real Codex CLI 0.162.1 reached
/responseswithout an API key or Authorization header. The mock deliberately returned 401; this verifies client startup, not a live Entra exchange.
No live Azure/GitHub OIDC exchange has been performed for this patch.
Activity
SadriG91 commentedon Oct 13, 2026
Thank you for the quick turnaround on this 👏