Skip to content

fix(security): redact invalid workload identity access tokens - #2425

Merged
HAYDEN-OAI merged 5 commits into
mainfrom
autoimprove-workload-access-token-privacy-mt0pc2hu
Aug 20, 2026
Merged

fix(security): redact invalid workload identity access tokens#2425
HAYDEN-OAI merged 5 commits into
mainfrom
autoimprove-workload-access-token-privacy-mt0pc2hu

Conversation

@HAYDEN-OAI

Copy link
Copy Markdown
Contributor

Summary

  • Reject OAuth workload-identity access tokens that cannot safely be represented in an HTTP authorization field before caching or attaching bearer credentials.
  • Preserve the existing fixed, cause-free OpenAIError for malformed credentials and valid horizontal tabs, spaces, printable ASCII, and RFC obs-text bytes.
  • Cover direct authentication and the actual public client across JWT/ID providers, all forbidden control bytes, DEL, Unicode/surrogates, concurrent refreshes, poisoned-cache recovery, debug logs, and real loopback HTTP transport.

Regression proof

  • Fresh main: 154 failed / 14 passed in the new 168-case suite.
  • Fixed branch: 168 / 168 targeted cases and 266 / 266 authentication cases pass.

Validation

  • 4,056 handwritten tests across 125 files.
  • 559 generated tests across 82 suites (one existing skipped test), using an isolated loopback Steady server.
  • Repository lint and strict TypeScript checking.
  • Clean package build, published-source TypeScript 4.9 and 6 checks, and publint.
  • Packed npm artifact on Node 22 with CommonJS, ESM, published-source, and source-map checks.

@HAYDEN-OAI
HAYDEN-OAI requested a review from a team as a code owner August 19, 2026 23:08
@openai-sdks

openai-sdks Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

237/237 SDK tests passed in 9.758s for Node SDK PR #2425.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 122ms
tests/chat-completions-create.test.ts ✅ Passed 188ms
tests/chat-completions-stream.test.ts ✅ Passed 177ms
tests/files-content-binary.test.ts ✅ Passed 163ms
tests/files-create-multipart.test.ts ✅ Passed 160ms
tests/files-list-pagination.test.ts ✅ Passed 128ms
tests/initialize-config.test.ts ✅ Passed 136ms
tests/instance-isolation.test.ts ✅ Passed 85ms
tests/models-list.test.ts ✅ Passed 110ms
tests/responses-background-lifecycle.test.ts ✅ Passed 163ms
tests/responses-body-method-errors.test.ts ✅ Passed 319ms
tests/responses-cancel-timeout.test.ts ✅ Passed 196ms
tests/responses-cancel.test.ts ✅ Passed 175ms
tests/responses-compact-retries.test.ts ✅ Passed 203ms
tests/responses-compact.test.ts ✅ Passed 187ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 116ms
tests/responses-create-advanced.test.ts ✅ Passed 171ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.074s
tests/responses-create-errors.test.ts ✅ Passed 196ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 164ms
tests/responses-create-retries.test.ts ✅ Passed 269ms
tests/responses-create-stream-failures.test.ts ✅ Passed 171ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 2.136s
tests/responses-create-stream-wire.test.ts ✅ Passed 2.482s
tests/responses-create-stream.test.ts ✅ Passed 91ms
tests/responses-create-terminal-states.test.ts ✅ Passed 200ms
tests/responses-create-timeout.test.ts ✅ Passed 213ms
tests/responses-create.test.ts ✅ Passed 142ms
tests/responses-delete.test.ts ✅ Passed 262ms
tests/responses-input-items-errors.test.ts ✅ Passed 180ms
tests/responses-input-items-list.test.ts ✅ Passed 171ms
tests/responses-input-items-options.test.ts ✅ Passed 90ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 257ms
tests/responses-input-tokens-count.test.ts ✅ Passed 226ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.064s
tests/responses-not-found-errors.test.ts ✅ Passed 198ms
tests/responses-parse.test.ts ✅ Passed 177ms
tests/responses-retrieve-retries.test.ts ✅ Passed 234ms
tests/responses-retrieve.test.ts ✅ Passed 201ms
tests/responses-stored-method-errors.test.ts ✅ Passed 445ms
tests/retry-behavior.test.ts ✅ Passed 2.983s
tests/sdk-error-shape.test.ts ✅ Passed 236ms

View OkTest run #32316608443

SDK merge (842851955673) · head (43a529908cee) · base (39afa3ade234) · OkTest (2b1bdfd25e98)

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

34 mixed files remain; 0 existing customizations changed.

Compared 39afa3ade23443a529908cee. Generated baselines verified.

34 existing customizations unchanged
  • api.md
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py
  • src/client.ts
  • src/resources/audio/transcriptions.ts
  • src/resources/audio/translations.ts
  • src/resources/beta/assistants.ts
  • src/resources/beta/beta.ts
  • src/resources/beta/index.ts
  • src/resources/beta/responses/internal-base.ts
  • src/resources/beta/responses/responses.ts
  • src/resources/beta/threads/index.ts
  • src/resources/beta/threads/runs/index.ts
  • src/resources/beta/threads/runs/runs.ts
  • src/resources/beta/threads/threads.ts
  • src/resources/chat/completions/completions.ts
  • src/resources/chat/completions/index.ts
  • src/resources/conversations/index.ts
  • src/resources/embeddings.ts
  • src/resources/files.ts
  • src/resources/fine-tuning/checkpoints/permissions.ts
  • src/resources/images.ts
  • src/resources/responses/internal-base.ts
  • src/resources/responses/responses.ts
  • src/resources/skills/skills.ts
  • src/resources/skills/versions/versions.ts
  • src/resources/vector-stores/file-batches.ts
  • src/resources/vector-stores/files.ts
  • src/resources/webhooks/index.ts
  • src/resources/webhooks/webhooks.ts
  • tests/api-resources/embeddings.test.ts
  • tests/api-resources/responses/responses.test.ts
  • tests/lib/data-residency.test.ts

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 32316607637 --repo openai/openai-node \
  --name castiron-custom-code-32316607637-1 --dir /tmp/castiron-custom-code-32316607637-1
git apply --stat /tmp/castiron-custom-code-32316607637-1/custom-code.patch
cat /tmp/castiron-custom-code-32316607637-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin 39afa3ade23436802ab4373d0324b6312740f048 43a529908cee7f593a745caabe5d31c3b90044c3
python3 scripts/castiron/custom_code_report.py report \
  --base 39afa3ade23436802ab4373d0324b6312740f048 \
  --head 43a529908cee7f593a745caabe5d31c3b90044c3 --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-43a529908cee
cat /tmp/castiron-custom-code-43a529908cee/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e7f6bf3077

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/auth/workload-identity-auth.ts Outdated

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Independent two-pass security review confirms the existing workload-identity token finding: values ending in HTTP whitespace pass validation and enter the cache, but standard Headers silently strips that whitespace before dispatch, so the wire credential differs from the validated credential. Reject leading/trailing HTTP whitespace before caching while preserving sanitized, cause-free errors. Severity is Medium: credential mismatch/authentication failure is proven; stronger compromise claims are speculative. Existing inline thread already covers this; no duplicate comment added.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19186b41c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/auth/workload-identity-auth.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ef9e8225f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/auth/workload-identity-auth.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7142b6eaae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/auth/workload-identity-access-token-privacy.test.ts

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed workload-identity credential validation, including leading/trailing HTTP whitespace, runtime-specific invalid header bytes, secret-free errors, and Bun compatibility. Previous normalization/privacy findings are fixed; CI is green.

@HAYDEN-OAI
HAYDEN-OAI added this pull request to the merge queue Aug 20, 2026
Merged via the queue into main with commit 0d28da3 Aug 20, 2026
32 checks passed
@HAYDEN-OAI
HAYDEN-OAI deleted the autoimprove-workload-access-token-privacy-mt0pc2hu branch August 20, 2026 19:53
@openai-sdks openai-sdks Bot mentioned this pull request Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants