Skip to content

fix(auth): harden X.509 refresh and diagnostic boundaries - #529

Merged
jbeckwith-oai merged 2 commits into
mainfrom
codex/x509-post-merge-hardening
Aug 25, 2026
Merged

fix(auth): harden X.509 refresh and diagnostic boundaries#529
jbeckwith-oai merged 2 commits into
mainfrom
codex/x509-post-merge-hardening

Conversation

@jbeckwith-oai

@jbeckwith-oai jbeckwith-oai commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow up on the merged five-PR X.509 workload-identity stack with one focused correctness, security, and documentation hardening change.

  • Preserve the exact still-valid X.509 bearer when proactive refresh encounters a transient issuer or connection failure; apply a bounded cooldown using one consistent monotonic-clock snapshot and fail closed for expired, invalidated, displaced, nontransient OAuth, and deadline-expired cases without changing legacy JWT behavior.
  • Strip signed query strings and fragments from authentication-stage timeout URLs, replace untrusted underlying exception messages with a safe diagnostic, and preserve the original request URL.
  • Redact provider/service-account identifiers from X509WorkloadIdentity and nested X509TokenExchange inspection while keeping RBI and RBS signatures aligned.
  • Make the README example self-contained, scope client certificates to the exact issuer/API TLS host and port, and clarify organization-gated workload identity versus organization/project mTLS.
  • Log only validated integer HTTP statuses in the optional standard smoke runner, preventing status-based secret disclosure and log injection.
  • Add separate focused security and proactive-refresh suites rather than growing existing oversized tests.

The shared cross-language mTLS runbook and dedicated X.509 design were separately updated to document the merged Ruby implementation, the actual public APIs, project setup, and key/secret management:

Verification

  • Ruby 4: 1,372 tests, 12,324 assertions, zero failures/errors.
  • Ruby 3.3: 1,372 tests, 12,323 assertions, zero failures/errors.
  • bundle exec rake lint: 2,773 files inspected; no offenses; Ruby formatting, Sorbet, and all 1,244 RBS signatures clean.
  • Focused public-entrypoint regressions cover transient 408/409/429/5xx and connection/timeout refresh failures, bounded cooldown, monotonic expiry-boundary races, original issuer-error preservation after accepted fallback expires, serial isolation of global clock overrides, stale/expired/invalidated credentials, OAuth rejection, caller deadlines, signed query/fragment and raw-timeout-message redaction, identifier-free inspection, and malicious status log injection.
  • A real production certificate exchange and mTLS model-list request succeeded with ambient OPENAI_LOG=debug.
  • Independent generalized, strict maintainability, and authentication/TLS security reviews completed; no workflow or release changes.
  • Trusted generated-code budget verification: 2,933 / 4,000 lines; 1,067 lines remaining.

Review requested from @openai/sdks-team.

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

chatgpt-codex-connector Bot commented Aug 25, 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-25T17:09:58.282137Z b61f8ed New commits
🔒 Security Review Completed 2026-08-25T17:10:34.424624Z b61f8ed 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 25, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

237/237 SDK tests passed in 8.553s for Ruby SDK PR #529.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 158ms
tests/chat-completions-create.test.ts ✅ Passed 180ms
tests/chat-completions-stream.test.ts ✅ Passed 103ms
tests/files-content-binary.test.ts ✅ Passed 161ms
tests/files-create-multipart.test.ts ✅ Passed 157ms
tests/files-list-pagination.test.ts ✅ Passed 125ms
tests/initialize-config.test.ts ✅ Passed 148ms
tests/instance-isolation.test.ts ✅ Passed 109ms
tests/models-list.test.ts ✅ Passed 134ms
tests/responses-background-lifecycle.test.ts ✅ Passed 209ms
tests/responses-body-method-errors.test.ts ✅ Passed 363ms
tests/responses-cancel-timeout.test.ts ✅ Passed 238ms
tests/responses-cancel.test.ts ✅ Passed 360ms
tests/responses-compact-retries.test.ts ✅ Passed 183ms
tests/responses-compact.test.ts ✅ Passed 230ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 141ms
tests/responses-create-advanced.test.ts ✅ Passed 137ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.018s
tests/responses-create-errors.test.ts ✅ Passed 263ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 95ms
tests/responses-create-retries.test.ts ✅ Passed 221ms
tests/responses-create-stream-failures.test.ts ✅ Passed 113ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 191ms
tests/responses-create-stream-wire.test.ts ✅ Passed 1.86s
tests/responses-create-stream.test.ts ✅ Passed 192ms
tests/responses-create-terminal-states.test.ts ✅ Passed 323ms
tests/responses-create-timeout.test.ts ✅ Passed 245ms
tests/responses-create.test.ts ✅ Passed 142ms
tests/responses-delete.test.ts ✅ Passed 159ms
tests/responses-input-items-errors.test.ts ✅ Passed 139ms
tests/responses-input-items-list.test.ts ✅ Passed 143ms
tests/responses-input-items-options.test.ts ✅ Passed 94ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 256ms
tests/responses-input-tokens-count.test.ts ✅ Passed 237ms
tests/responses-malformed-inputs.test.ts ✅ Passed 1.508s
tests/responses-not-found-errors.test.ts ✅ Passed 363ms
tests/responses-parse.test.ts ✅ Passed 151ms
tests/responses-retrieve-retries.test.ts ✅ Passed 214ms
tests/responses-retrieve.test.ts ✅ Passed 197ms
tests/responses-stored-method-errors.test.ts ✅ Passed 728ms
tests/retry-behavior.test.ts ✅ Passed 3.184s
tests/sdk-error-shape.test.ts ✅ Passed 372ms

View OkTest run #32876036774

SDK merge (0238107d720f) · head (b61f8ed17473) · base (712f3c844530) · OkTest (2b1bdfd25e98)

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

47 mixed files remain; 1 existing customization changed.

Compared 712f3c844530b61f8ed17473. Generated baselines verified.

File Result Current custom patch
lib/openai/client.rb Existing customization changed +488 / −20
46 existing customizations unchanged
  • lib/openai.rb
  • lib/openai/models/chat/chat_completion_message.rb
  • lib/openai/models/chat/chat_completion_message_function_tool_call.rb
  • lib/openai/models/chat/completion_create_params.rb
  • lib/openai/models/response_format_json_schema.rb
  • lib/openai/models/responses/function_tool.rb
  • lib/openai/models/responses/response.rb
  • lib/openai/models/responses/response_create_params.rb
  • lib/openai/models/responses/response_format_text_config.rb
  • lib/openai/models/responses/response_format_text_json_schema_config.rb
  • lib/openai/models/responses/response_function_tool_call.rb
  • lib/openai/models/responses/response_function_web_search.rb
  • lib/openai/models/responses/response_output_text.rb
  • lib/openai/models/responses/tool.rb
  • lib/openai/resources/beta/threads.rb
  • lib/openai/resources/chat/completions.rb
  • lib/openai/resources/files.rb
  • lib/openai/resources/responses.rb
  • lib/openai/resources/vector_stores/file_batches.rb
  • lib/openai/resources/vector_stores/files.rb
  • lib/openai/resources/webhooks.rb
  • rbi/openai/client.rbi
  • rbi/openai/models/chat/chat_completion_message.rbi
  • rbi/openai/models/chat/chat_completion_message_function_tool_call.rbi
  • rbi/openai/models/chat/completion_create_params.rbi
  • rbi/openai/models/response_format_json_schema.rbi
  • rbi/openai/models/responses/response.rbi
  • rbi/openai/models/responses/response_create_params.rbi
  • rbi/openai/models/responses/response_function_tool_call.rbi
  • rbi/openai/models/responses/response_function_web_search.rbi
  • rbi/openai/models/responses/response_output_text.rbi
  • rbi/openai/resources/chat/completions.rbi
  • rbi/openai/resources/files.rbi
  • rbi/openai/resources/responses.rbi
  • rbi/openai/resources/vector_stores/file_batches.rbi
  • rbi/openai/resources/vector_stores/files.rbi
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py
  • sig/openai/client.rbs

6 more in the full report.

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

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

git fetch --no-tags origin 712f3c84453006583dae5850008ea18101d01756 b61f8ed17473d0d487ddbb76caf727849da4c5e1
python3 scripts/castiron/custom_code_report.py report \
  --base 712f3c84453006583dae5850008ea18101d01756 \
  --head b61f8ed17473d0d487ddbb76caf727849da4c5e1 --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-b61f8ed17473
cat /tmp/castiron-custom-code-b61f8ed17473/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

Comment thread test/openai/auth/x509_proactive_refresh_test.rb Fixed
Comment thread test/openai/auth/x509_proactive_refresh_test.rb Fixed
Comment thread test/openai/auth/x509_proactive_refresh_test.rb Fixed

@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: 595f66d367

ℹ️ 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 lib/openai/auth/workload_identity_auth.rb

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

[sdk codex review] Approving b61f8ed17473d0d487ddbb76caf727849da4c5e1 after two independent full reviews of all 13 changed files and the supporting auth/client contracts. No substantiated blocking issue found.

The proactive-refresh fallback preserves token validity, invalidation and deadline boundaries, uses a bounded monotonic cooldown, and retains the original issuer failure across expiry. The existing expiry-boundary feedback is substantively addressed, with deterministic regression coverage; legacy JWT behavior remains unchanged. The diagnostic changes, destination-scoped README setup, signature parity and test isolation are consistent with the implementation. Existing feedback was checked; no duplicate inline comments are needed.

Verified primary hosted CI on merge 0238107d720fd57bba0fb097d9eec226384dd4b5 (this head + current main at 712f3c84453006583dae5850008ea18101d01756): Ruby 3.3.12/3.4.10/4.0.6 each passed 1,372 tests with zero failures, errors or skips. Gem packaging, the Sorbet examples check and RBS validation passed. OkTest passed 237 tests across 42 suites against the same SDK merge.

Head, base, author, open/non-draft status and mergeability rechecked immediately before submission. No new scans, candidate execution or live credential tests were performed for this review.

@jbeckwith-oai
jbeckwith-oai added this pull request to the merge queue Aug 25, 2026
Merged via the queue into main with commit dd0a37c Aug 25, 2026
28 of 30 checks passed
@jbeckwith-oai
jbeckwith-oai deleted the codex/x509-post-merge-hardening branch August 25, 2026 17:24
@openai-sdks openai-sdks Bot mentioned this pull request Aug 25, 2026
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