Skip to content

fix: validate workload identity access tokens#1885

Open
pragnyanramtha wants to merge 1 commit into
openai:masterfrom
pragnyanramtha:codex/validate-workload-access-token
Open

fix: validate workload identity access tokens#1885
pragnyanramtha wants to merge 1 commit into
openai:masterfrom
pragnyanramtha:codex/validate-workload-access-token

Conversation

@pragnyanramtha
Copy link
Copy Markdown

Summary

  • validate successful workload identity token exchange responses before caching them
  • throw an OpenAIError when a 200 response omits or returns an empty access_token
  • preserve the existing default expires_in behavior while respecting explicit 0 with nullish coalescing

Why

A malformed token exchange success response was previously trusted and cached. If access_token was absent, getToken() could return undefined, allowing downstream requests to construct an invalid bearer token instead of failing at the authentication boundary.

Validation

  • yarn test tests/auth/workload-identity-auth.test.ts --runInBand
  • yarn test tests/lib/workload-identity.test.ts --runInBand
  • ./node_modules/.bin/prettier --check src/auth/workload-identity-auth.ts tests/auth/workload-identity-auth.test.ts
  • ./node_modules/.bin/eslint src/auth/workload-identity-auth.ts tests/auth/workload-identity-auth.test.ts
  • ./scripts/build
  • git diff --check

@pragnyanramtha pragnyanramtha marked this pull request as ready for review May 17, 2026 04:26
@pragnyanramtha pragnyanramtha requested a review from a team as a code owner May 17, 2026 04:26
Copilot AI review requested due to automatic review settings May 17, 2026 04:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants