Skip to content

fix(ws): block custom credential headers on redirects - #2429

Open
HAYDEN-OAI wants to merge 3 commits into
mainfrom
autoimprove/ws-token-header-redirect-mt0xmyx8
Open

fix(ws): block custom credential headers on redirects#2429
HAYDEN-OAI wants to merge 3 commits into
mainfrom
autoimprove/ws-token-header-redirect-mt0xmyx8

Conversation

@HAYDEN-OAI

Copy link
Copy Markdown
Contributor

Summary

  • Recognize well-known auth, access, session, and AWS security token headers as credentials before following WebSocket redirects.
  • Prevent both stable and beta public Responses WebSocket clients from forwarding those credentials to another origin.
  • Preserve existing Authorization, Cookie, API-key, harmless-header, redirect, and options behavior.

Validation

  • Regression first: 40 failing security cases and 19 passing controls on unchanged main; all 59 pass after the fix.
  • 109 existing and new public WebSocket redirect regressions pass against real ws sockets and loopback HTTP servers.
  • Full handwritten suite: 4,103 passing; generated suite: 559 passing.
  • Full lint, strict repository TypeScript, build, published TypeScript 4.9 and current, publint, and packed CommonJS/ESM/source-map consumer checks pass.

@HAYDEN-OAI
HAYDEN-OAI requested a review from a team as a code owner August 20, 2026 03:03
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-08-20T03:24:11.887238Z 39ff2fe New commits
🔒 Security Review 🔄 Running since 2026-08-20T03:24:09.163403Z 39ff2fe New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openai-sdks

openai-sdks Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

237/237 SDK tests passed in 11.503s for Node SDK PR #2429.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 183ms
tests/chat-completions-create.test.ts ✅ Passed 306ms
tests/chat-completions-stream.test.ts ✅ Passed 129ms
tests/files-content-binary.test.ts ✅ Passed 116ms
tests/files-create-multipart.test.ts ✅ Passed 185ms
tests/files-list-pagination.test.ts ✅ Passed 149ms
tests/initialize-config.test.ts ✅ Passed 240ms
tests/instance-isolation.test.ts ✅ Passed 131ms
tests/models-list.test.ts ✅ Passed 134ms
tests/responses-background-lifecycle.test.ts ✅ Passed 314ms
tests/responses-body-method-errors.test.ts ✅ Passed 484ms
tests/responses-cancel-timeout.test.ts ✅ Passed 272ms
tests/responses-cancel.test.ts ✅ Passed 324ms
tests/responses-compact-retries.test.ts ✅ Passed 313ms
tests/responses-compact.test.ts ✅ Passed 313ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 223ms
tests/responses-create-advanced.test.ts ✅ Passed 237ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.153s
tests/responses-create-errors.test.ts ✅ Passed 303ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 131ms
tests/responses-create-retries.test.ts ✅ Passed 371ms
tests/responses-create-stream-failures.test.ts ✅ Passed 255ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 2.157s
tests/responses-create-stream-wire.test.ts ✅ Passed 2.467s
tests/responses-create-stream.test.ts ✅ Passed 129ms
tests/responses-create-terminal-states.test.ts ✅ Passed 314ms
tests/responses-create-timeout.test.ts ✅ Passed 242ms
tests/responses-create.test.ts ✅ Passed 352ms
tests/responses-delete.test.ts ✅ Passed 293ms
tests/responses-input-items-errors.test.ts ✅ Passed 178ms
tests/responses-input-items-list.test.ts ✅ Passed 183ms
tests/responses-input-items-options.test.ts ✅ Passed 159ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 332ms
tests/responses-input-tokens-count.test.ts ✅ Passed 267ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.267s
tests/responses-not-found-errors.test.ts ✅ Passed 268ms
tests/responses-parse.test.ts ✅ Passed 269ms
tests/responses-retrieve-retries.test.ts ✅ Passed 333ms
tests/responses-retrieve.test.ts ✅ Passed 240ms
tests/responses-stored-method-errors.test.ts ✅ Passed 711ms
tests/retry-behavior.test.ts ✅ Passed 3.06s
tests/sdk-error-shape.test.ts ✅ Passed 399ms

View OkTest run #32328083358

SDK merge (4a745210e7c1) · head (39ff2fec0fb0) · base (a0d68cc53125) · OkTest (2b1bdfd25e98)

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

34 mixed files remain; 0 existing customizations changed.

Compared a0d68cc5312539ff2fec0fb0. 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 32328082743 --repo openai/openai-node \
  --name castiron-custom-code-32328082743-1 --dir /tmp/castiron-custom-code-32328082743-1
git apply --stat /tmp/castiron-custom-code-32328082743-1/custom-code.patch
cat /tmp/castiron-custom-code-32328082743-1/custom-code.patch

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

git fetch --no-tags origin a0d68cc53125c2cb82eab31271b8984b8d65d4b2 39ff2fec0fb0be9f722dc686e2d7f3894678b9bc
python3 scripts/castiron/custom_code_report.py report \
  --base a0d68cc53125c2cb82eab31271b8984b8d65d4b2 \
  --head 39ff2fec0fb0be9f722dc686e2d7f3894678b9bc --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-39ff2fec0fb0
cat /tmp/castiron-custom-code-39ff2fec0fb0/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: 9f4e2e1b62

ℹ️ 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/internal/ws.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: 889c0cc9b1

ℹ️ 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/internal/ws.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 of the updated head confirms the previous X-Authentication-Token bypass was fixed, but the existing new High finding remains: other supported caller credential headers such as X-Refresh-Token, X-ID-Token, and X-Bearer-Token still evade name matching and are forwarded cross-origin by both public Responses WebSocket clients. Prevent cross-origin forwarding for arbitrary caller headers or use a safe allowlist rather than extending an inherently incomplete credential denylist. Existing exact-head inline thread already covers this; no duplicate comment added.

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