Skip to content

fix(security): redact GCP metadata authentication error bodies - #2399

Merged
HAYDEN-OAI merged 3 commits into
mainfrom
fix/gcp-metadata-error-body-privacy
Aug 18, 2026
Merged

HAYDEN-OAI merged 3 commits into
mainfrom
fix/gcp-metadata-error-body-privacy

Conversation

@HAYDEN-OAI

Copy link
Copy Markdown
Contributor

Summary

  • Avoid reading or copying non-successful Google Cloud metadata responses into workload-identity authentication errors.
  • Preserve the existing error type, provider, nested cause, HTTP status, timeout cleanup, successful token parsing, and request metadata.
  • Add real public-provider and OpenAI client regressions for JSON, HTML, and plain-text failures across HTTP 401, 403, and 500.

Validation

  • Regression-first: seven privacy cases failed before the fix; all eight dedicated cases now pass.
  • 55 focused auth and workload-identity tests.
  • 3,301 handwritten tests and 559 generated tests.
  • Repository lint, strict TypeScript, production build, and packed CommonJS/ESM consumers with TypeScript 4.9 and current TypeScript.

@openai-sdks

openai-sdks Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

OkTest Summary

✅ 237/237 SDK tests passed in 10.031s for Node SDK PR #2399.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 161ms
tests/chat-completions-create.test.ts ✅ Passed 228ms
tests/chat-completions-stream.test.ts ✅ Passed 195ms
tests/files-content-binary.test.ts ✅ Passed 165ms
tests/files-create-multipart.test.ts ✅ Passed 132ms
tests/files-list-pagination.test.ts ✅ Passed 140ms
tests/initialize-config.test.ts ✅ Passed 200ms
tests/instance-isolation.test.ts ✅ Passed 104ms
tests/models-list.test.ts ✅ Passed 120ms
tests/responses-background-lifecycle.test.ts ✅ Passed 207ms
tests/responses-body-method-errors.test.ts ✅ Passed 367ms
tests/responses-cancel-timeout.test.ts ✅ Passed 216ms
tests/responses-cancel.test.ts ✅ Passed 195ms
tests/responses-compact-retries.test.ts ✅ Passed 217ms
tests/responses-compact.test.ts ✅ Passed 170ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 114ms
tests/responses-create-advanced.test.ts ✅ Passed 138ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.106s
tests/responses-create-errors.test.ts ✅ Passed 172ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 138ms
tests/responses-create-retries.test.ts ✅ Passed 235ms
tests/responses-create-stream-failures.test.ts ✅ Passed 207ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 2.15s
tests/responses-create-stream-wire.test.ts ✅ Passed 2.538s
tests/responses-create-stream.test.ts ✅ Passed 71ms
tests/responses-create-terminal-states.test.ts ✅ Passed 193ms
tests/responses-create-timeout.test.ts ✅ Passed 209ms
tests/responses-create.test.ts ✅ Passed 180ms
tests/responses-delete.test.ts ✅ Passed 220ms
tests/responses-input-items-errors.test.ts ✅ Passed 230ms
tests/responses-input-items-list.test.ts ✅ Passed 170ms
tests/responses-input-items-options.test.ts ✅ Passed 126ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 263ms
tests/responses-input-tokens-count.test.ts ✅ Passed 211ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.168s
tests/responses-not-found-errors.test.ts ✅ Passed 296ms
tests/responses-parse.test.ts ✅ Passed 167ms
tests/responses-retrieve-retries.test.ts ✅ Passed 267ms
tests/responses-retrieve.test.ts ✅ Passed 208ms
tests/responses-stored-method-errors.test.ts ✅ Passed 462ms
tests/retry-behavior.test.ts ✅ Passed 2.906s
tests/sdk-error-shape.test.ts ✅ Passed 237ms

View OkTest run #32174887357

SDK merge (d7e2d6645991) · head (26ddd3733dfb) · base (dd945e63d9c3) · OkTest (7e7850017529)

@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: edffd26f5f

ℹ️ 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/subject-token-providers.ts Resolved

@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.

[P2] Confirmed the existing exact-head concern without duplicating its inline: #2399 (comment). The changed GCP metadata HTTP-error branch throws without consuming, canceling, or aborting response.body, and then clears the only abort timeout. An independent local streaming-HTTP reproduction confirmed that the previous path closed an indefinitely streaming 503 response while the new path rejected authentication and left its network connection open; repeated failures can accumulate sockets/resources. Preserve the new status-only redaction while disposing of the stream through Shims.CancelReadableStream(response.body). Suppress cancellation errors and abort the request if cleanup fails, because a custom stream can reject cancellation with a secret-bearing error that must not replace or contaminate the sanitized status-only error/cause. Add streaming-body cancellation and secret-bearing cancellation-rejection regressions.

@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: 27d1fbd883

ℹ️ 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/subject-token-providers.ts Resolved

@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.

[P2] The previous response-body leak is fixed, but the new direct await of Shims.CancelReadableStream(response.body) can permanently hang on a supported custom Fetch ReadableStream whose cancel() never settles. The configured timeout aborts the controller but does not settle that independent cancellation promise, so getToken() never throws its sanitized status error and the shared workload-identity refresh promise blocks every caller. Existing current inline already reports it: #2399 (comment). Race cleanup against the abort signal, dispose the temporary listener, suppress secret-bearing cleanup failures, and retain the original sanitized error. Add a cancellation-never-settles regression.

@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 re-review confirmed both prior issues are resolved. Non-OK metadata response streams are canceled without reading sensitive bodies, cancellation races the configured abort timeout, abort listeners are removed, late or secret-bearing cancellation failures cannot leak or hang shared workload authentication, and focused regressions cover detached never-settling custom streams. No remaining findings.

@HAYDEN-OAI
HAYDEN-OAI added this pull request to the merge queue Aug 18, 2026
Merged via the queue into main with commit 322840c Aug 18, 2026
27 checks passed
@HAYDEN-OAI
HAYDEN-OAI deleted the fix/gcp-metadata-error-body-privacy branch August 18, 2026 19:22
@openai-sdks openai-sdks Bot mentioned this pull request Aug 18, 2026

This branch was successfully deployed

1 active deployment
ci — 26ddd373 Deployed Aug 18, 2026 by HAYDEN-OAI via ecosystem tests #8466
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.

3 participants