Skip to content

fix(auth): secure first-class X.509 workload credentials - #2479

Open
jbeckwith-oai wants to merge 2 commits into
mainfrom
codex/x509-secure-credential-followup
Open

fix(auth): secure first-class X.509 workload credentials#2479
jbeckwith-oai wants to merge 2 commits into
mainfrom
codex/x509-secure-credential-followup

Conversation

@jbeckwith-oai

Copy link
Copy Markdown
Contributor

Summary

  • Add first-class SDK-owned workloadIdentity.fromX509(...) credentials accepted by new OpenAI({ credential }), with explicit credential ownership, independently scoped target/proxy TLS trust, certificate/key validation, and fail-closed legacy transport verification.
  • Repair the documented openai/auth CommonJS and ESM entrypoints while preserving optional Undici isolation and blocking private credential-state package subpaths.
  • Honor canonical X.509 refreshBufferSeconds, retain the deprecated refreshBufferMs compatibility alias, and reject conflicting or malformed refresh settings.
  • Keep asynchronous protected retry hooks outside the X.509 network timeout while preserving one shared issuer/API/backoff deadline and secure cloning between ordinary, provider, and credential clients.
  • Update canonical authentication documentation and the runnable mTLS example; add genuine public-entrypoint mTLS, transport/privacy, proxy, cancellation, clone, historical Undici, and packed-artifact regressions.

Verification

  • ./scripts/test: 6,573 handwritten + 556 generated tests passing.
  • Node 22.23.2 and 26.7.0: 410 focused X.509 tests passing on each runtime; current Node full suite passing.
  • All 14 ecosystem integrations passing, including browser/Webpack, Cloudflare Workers, Vercel Edge, Bun, Deno, CJS, and ESM.
  • Actual packed npm artifact on Node 22: CJS/ESM exports, optional-peer absence, private-subpath isolation, and 281/321 source checks across 1,282 source maps passing.
  • Actual Undici 5.5.1, 5.29, 6.28, and 7.29: direct, HTTP CONNECT, and HTTPS CONNECT compatibility verified; Undici 5.2 direct supported and unsupported proxy metadata rejected safely.
  • pnpm lint, pnpm exec tsc --noEmit, pnpm build, and TypeScript 4.9 declaration checking passing.
  • Trusted Castiron custom-code budget: 2,974 / 3,000; no ratchet increase or policy change.
  • Two independent thermo-nuclear architecture/general/security reviews, repeated after remediation and structural extraction, both clean.

Compatibility and rollout

  • Existing safe createX509Transport(...) integrations remain supported; SDK-owned first-class credentials are the recommended secure path.
  • refreshBufferMs remains a deprecated compatibility alias; simultaneous seconds/milliseconds options fail clearly.
  • Undici remains an optional peer and unrelated/browser clients do not import Node-only transport dependencies.

@jbeckwith-oai
jbeckwith-oai requested a review from a team as a code owner August 26, 2026 05:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 26, 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 Completed 2026-08-26T05:36:29.702862Z 5bab259 New commits
🔒 Security Review Completed 2026-08-26T05:36:53.772037Z 5bab259 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 26, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

237/237 SDK tests passed in 10.036s for Node SDK PR #2479.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 131ms
tests/chat-completions-create.test.ts ✅ Passed 261ms
tests/chat-completions-stream.test.ts ✅ Passed 173ms
tests/files-content-binary.test.ts ✅ Passed 139ms
tests/files-create-multipart.test.ts ✅ Passed 130ms
tests/files-list-pagination.test.ts ✅ Passed 135ms
tests/initialize-config.test.ts ✅ Passed 161ms
tests/instance-isolation.test.ts ✅ Passed 138ms
tests/models-list.test.ts ✅ Passed 130ms
tests/responses-background-lifecycle.test.ts ✅ Passed 244ms
tests/responses-body-method-errors.test.ts ✅ Passed 298ms
tests/responses-cancel-timeout.test.ts ✅ Passed 189ms
tests/responses-cancel.test.ts ✅ Passed 233ms
tests/responses-compact-retries.test.ts ✅ Passed 219ms
tests/responses-compact.test.ts ✅ Passed 215ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 119ms
tests/responses-create-advanced.test.ts ✅ Passed 230ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.064s
tests/responses-create-errors.test.ts ✅ Passed 221ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 150ms
tests/responses-create-retries.test.ts ✅ Passed 298ms
tests/responses-create-stream-failures.test.ts ✅ Passed 201ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 2.153s
tests/responses-create-stream-wire.test.ts ✅ Passed 2.323s
tests/responses-create-stream.test.ts ✅ Passed 75ms
tests/responses-create-terminal-states.test.ts ✅ Passed 252ms
tests/responses-create-timeout.test.ts ✅ Passed 191ms
tests/responses-create.test.ts ✅ Passed 160ms
tests/responses-delete.test.ts ✅ Passed 236ms
tests/responses-input-items-errors.test.ts ✅ Passed 167ms
tests/responses-input-items-list.test.ts ✅ Passed 169ms
tests/responses-input-items-options.test.ts ✅ Passed 95ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 258ms
tests/responses-input-tokens-count.test.ts ✅ Passed 234ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.017s
tests/responses-not-found-errors.test.ts ✅ Passed 231ms
tests/responses-parse.test.ts ✅ Passed 246ms
tests/responses-retrieve-retries.test.ts ✅ Passed 286ms
tests/responses-retrieve.test.ts ✅ Passed 234ms
tests/responses-stored-method-errors.test.ts ✅ Passed 555ms
tests/retry-behavior.test.ts ✅ Passed 3.008s
tests/sdk-error-shape.test.ts ✅ Passed 288ms

View OkTest run #32934503627

SDK merge (0db0b958f596) · head (5bab25987279) · base (6992683aaf20) · OkTest (2b1bdfd25e98)

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

32 mixed files remain; 1 existing customization changed.

Compared 6992683aaf205bab25987279. Generated baselines verified.

File Result Current custom patch
src/client.ts Existing customization changed +774 / −89
31 existing customizations unchanged
  • api.md
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py
  • 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/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 32934529417 --repo openai/openai-node \
  --name castiron-custom-code-32934529417-1 --dir /tmp/castiron-custom-code-32934529417-1
git apply --stat /tmp/castiron-custom-code-32934529417-1/custom-code.patch
cat /tmp/castiron-custom-code-32934529417-1/custom-code.patch

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

git fetch --no-tags origin 6992683aaf2014d5e625e8eeebb3906bd8651ff0 5bab25987279cbfa3a5ec73b3e66d83ac41a017d
python3 scripts/castiron/custom_code_report.py report \
  --base 6992683aaf2014d5e625e8eeebb3906bd8651ff0 \
  --head 5bab25987279cbfa3a5ec73b3e66d83ac41a017d --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-5bab25987279
cat /tmp/castiron-custom-code-5bab25987279/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: efde41142d

ℹ️ 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/auth/x509-credential-options.ts
Comment thread src/internal/auth/x509-credential-options.ts Outdated
Comment thread src/auth/x509-transport.ts
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.

1 participant