Skip to content

Support engine.auth provider: openai (workload identity federation for the OpenAI API) #75871

Done

Description

@benissimo

Summary

engine.auth supports keyless workload identity federation for azure, anthropic and gcp. There is no provider for OpenAI's own API, so a Codex (or other OpenAI-engine) workflow calling api.openai.com still needs a static OPENAI_API_KEY secret. OpenAI now documents workload identity federation with GitHub Actions OIDC as a supported way to authenticate to its API without a long-lived key.

Requesting engine.auth.provider: openai, handled by the AWF API proxy the same way as the existing providers.

What exists today

OpenAI's flow

Docs:

  1. The job has id-token: write and requests a GitHub OIDC token for an audience configured in OpenAI (for example https://api.openai.com/v1).
  2. The token is exchanged at https://auth.openai.com/oauth/token (RFC 8693 token exchange, JSON body). Required fields: grant_type, subject_token_type, subject_token, identity_provider_id, service_account_id.
  3. The response is a short-lived bearer access_token (at most one hour, no refresh token) used to authenticate API requests.
  4. In OpenAI, an admin creates a Workload Identity Provider (issuer https://token.actions.githubusercontent.com, audience) and a service account mapping that pins GitHub claims such as repository, ref, environment and workflow_ref to a project and service account.

OpenAI's SDKs do the exchange in-process through a workloadIdentity client option (identityProviderId, serviceAccountId, and a token-provider function). The documented GitHub Actions examples read the three non-secret values from workflow variables: OPENAI_IDENTITY_PROVIDER_ID, OPENAI_SERVICE_ACCOUNT_ID, OPENAI_WIF_AUDIENCE.

Proposed shape

engine:
  id: codex
  auth:
    type: github-oidc
    provider: openai
    identity-provider-id: ${{ vars.OPENAI_IDENTITY_PROVIDER_ID }}
    service-account-id: ${{ vars.OPENAI_SERVICE_ACCOUNT_ID }}
    audience: https://api.openai.com/v1

Field mapping against the existing providers:

Concept anthropic openai
Trust anchor federation-rule-id, organization-id, workspace-id identity-provider-id
Identity service-account-id service-account-id
Audience optional audience: audience: (must match the OpenAI provider exactly)

The proxy would request the GitHub OIDC token, perform the exchange, re-exchange before expiry, and inject the bearer token on upstream requests so the agent container never holds a credential.

Open questions

  • Whether the native Codex engine accepts an exchanged access token as its bearer credential. OpenAI's Codex federation path is documented separately (a token file via OPENAI_IDENTITY_TOKEN_FILE) and is described as beta.
  • Whether the proxy should support this for non-Codex engines that call api.openai.com directly.

I have not verified that an exchanged token works end to end through the AWF proxy; that needs a trial against a real OpenAI organization.

Activity

  1. locked and limited conversation to collaborators on Nov 8, 2026
  2. unlocked this conversation on Nov 8, 2026
  3. benissimo commented on Nov 9, 2026

    @benissimo
    Author

    Closed by #75927, but OpenAI WIF is not usable end to end yet: the AWF API proxy has no OpenAI WIF provider (github/gh-aw-firewall#11355), no minimum-version check was added, and several review comments on the PR have no visible fix. Remaining work is tracked in #76221.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions