Skip to content

feat: integrate X.509 workload identity with OkHttp clients - #948

Merged
jbeckwith-oai merged 2 commits into
mainfrom
codex/x509-workload-identity-integration
Aug 27, 2026
Merged

feat: integrate X.509 workload identity with OkHttp clients#948
jbeckwith-oai merged 2 commits into
mainfrom
codex/x509-workload-identity-integration

Conversation

@jbeckwith-oai

Copy link
Copy Markdown
Contributor

Summary

  • Add a Java-friendly X509WorkloadIdentity configuration for an identity-provider ID, service-account ID, existing fixed-alias X509Transport, and optional token-refresh buffer.
  • Integrate the existing X.509 token exchange and isolated mutual-TLS transport with both synchronous and asynchronous public OkHttp SDK clients, including lazy acquisition, cached bearer authentication, proactive refresh, rejected-token refresh/retry, and owned-resource cleanup.
  • Add public-entrypoint real-TLS regression coverage, README guidance, and a compilable PKCS#12 Java example without changing existing JWT workload-identity APIs.

Security and scope

  • Both exchange and API connections retain fixed-alias mTLS, native hostname verification, isolated connection pools, direct connections, disabled redirects, and existing authorization-header redaction.
  • Reject competing API-key authentication and unsupported custom transport settings; reject unrepresentable token expirations without hanging asynchronous requests and invalidate only the specific bearer rejected by a 401.
  • This PR does not change the independent transport-origin guard, opt-in live-smoke implementation, missing-secrets workflow, generated metadata, or custom-code budget.

Verification

  • Focused existing X.509 transport/exchange/wire-contract/native-mTLS suites and new synchronous/asynchronous real-TLS integration regressions.
  • Existing JWT WorkloadIdentityAuthTest, WorkloadIdentityHttpClientTest, and ClientOptionsTest compatibility coverage.
  • OkHttp Kotlin lint, Java example formatting/lint/compilation, and the isolated OkHttp runtime compatibility probe on installed Java 21.
  • New SDK classfile verified at major version 52 (Java 8); this machine does not have a Java 8 runtime installed.
  • Trusted main-branch custom-code budget check against the verified generated snapshot.
  • Independent fresh-context adversarial correctness/security and architecture review.

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

53 mixed files remain; 0 existing customizations changed.

Compared 24089bd23b83c5ac1a190b7f. Generated baselines verified.

53 existing customizations unchanged
  • openai-java-core/src/main/kotlin/com/openai/models/audio/AudioResponseFormat.kt
  • openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionCreateParams.kt
  • openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionMessageFunctionToolCall.kt
  • openai-java-core/src/main/kotlin/com/openai/models/chat/completions/ChatCompletionToolMessageParam.kt
  • openai-java-core/src/main/kotlin/com/openai/models/embeddings/Embedding.kt
  • openai-java-core/src/main/kotlin/com/openai/models/embeddings/EmbeddingCreateParams.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseCreateParams.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionToolCall.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseFunctionWebSearch.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseTextConfig.kt
  • openai-java-core/src/main/kotlin/com/openai/models/videos/Video.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/BetaServiceAsync.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/BetaServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsync.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/WebhookServiceAsync.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/WebhookServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/audio/TranscriptionServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/chat/ChatCompletionServiceAsync.kt
  • openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/checkpoints/PermissionServiceAsyncImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/BetaService.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/BetaServiceImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseService.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/WebhookService.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/WebhookServiceImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/audio/TranscriptionServiceImpl.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/chat/ChatCompletionService.kt
  • openai-java-core/src/main/kotlin/com/openai/services/blocking/finetuning/checkpoints/PermissionServiceImpl.kt
  • openai-java-core/src/test/kotlin/com/openai/models/beta/responses/BetaResponsesServerEventTest.kt
  • openai-java-core/src/test/kotlin/com/openai/models/responses/ResponsesServerEventTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/CompletionServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/ImageServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/ResponseServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/WebhookServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/audio/TranscriptionServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/beta/ResponseServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/beta/ThreadServiceAsyncTest.kt
  • openai-java-core/src/test/kotlin/com/openai/services/async/beta/threads/RunServiceAsyncTest.kt

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

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

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

@jbeckwith-oai
jbeckwith-oai marked this pull request as ready for review August 27, 2026 18:34
@jbeckwith-oai
jbeckwith-oai requested a review from a team as a code owner August 27, 2026 18:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 27, 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-27T19:48:28.963320Z c5ac1a1 New commits
🔒 Security Review Completed 2026-08-27T19:48:21.725875Z c5ac1a1 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 27, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

237/237 SDK tests passed in 18.999s for Java SDK PR #948.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 201ms
tests/chat-completions-create.test.ts ✅ Passed 514ms
tests/chat-completions-stream.test.ts ✅ Passed 676ms
tests/files-content-binary.test.ts ✅ Passed 305ms
tests/files-create-multipart.test.ts ✅ Passed 448ms
tests/files-list-pagination.test.ts ✅ Passed 348ms
tests/initialize-config.test.ts ✅ Passed 198ms
tests/instance-isolation.test.ts ✅ Passed 155ms
tests/models-list.test.ts ✅ Passed 411ms
tests/responses-background-lifecycle.test.ts ✅ Passed 355ms
tests/responses-body-method-errors.test.ts ✅ Passed 525ms
tests/responses-cancel-timeout.test.ts ✅ Passed 236ms
tests/responses-cancel.test.ts ✅ Passed 489ms
tests/responses-compact-retries.test.ts ✅ Passed 440ms
tests/responses-compact.test.ts ✅ Passed 405ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 631ms
tests/responses-create-advanced.test.ts ✅ Passed 1.506s
tests/responses-create-disconnect.test.ts ✅ Passed 1.427s
tests/responses-create-errors.test.ts ✅ Passed 313ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 250ms
tests/responses-create-retries.test.ts ✅ Passed 308ms
tests/responses-create-stream-failures.test.ts ✅ Passed 1.761s
tests/responses-create-stream-timeout.test.ts ✅ Passed 278ms
tests/responses-create-stream-wire.test.ts ✅ Passed 7.363s
tests/responses-create-stream.test.ts ✅ Passed 110ms
tests/responses-create-terminal-states.test.ts ✅ Passed 437ms
tests/responses-create-timeout.test.ts ✅ Passed 244ms
tests/responses-create.test.ts ✅ Passed 388ms
tests/responses-delete.test.ts ✅ Passed 302ms
tests/responses-input-items-errors.test.ts ✅ Passed 530ms
tests/responses-input-items-list.test.ts ✅ Passed 634ms
tests/responses-input-items-options.test.ts ✅ Passed 211ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 234ms
tests/responses-input-tokens-count.test.ts ✅ Passed 410ms
tests/responses-malformed-inputs.test.ts ✅ Passed 5.695s
tests/responses-not-found-errors.test.ts ✅ Passed 421ms
tests/responses-parse.test.ts ✅ Passed 581ms
tests/responses-retrieve-retries.test.ts ✅ Passed 451ms
tests/responses-retrieve.test.ts ✅ Passed 210ms
tests/responses-stored-method-errors.test.ts ✅ Passed 1.095s
tests/retry-behavior.test.ts ✅ Passed 3.748s
tests/sdk-error-shape.test.ts ✅ Passed 446ms

View OkTest run #33110027965

SDK merge (87208890ab8e) · head (c5ac1a190b7f) · base (24089bd23b83) · OkTest (2b1bdfd25e98)

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

Reviewed a74fec31ee9f786c61923862585373d1f3164810 across all seven changed files and the authentication, retry, lifecycle, and TLS call paths. No additional nonduplicate findings. Please land the already-open transport-origin work in #946 and rebase this integration on it before approval.

Validation was static source review; I did not run the Java or live X.509 suites.

@jbeckwith-oai
jbeckwith-oai force-pushed the codex/x509-workload-identity-integration branch from a74fec3 to 93c3f40 Compare August 27, 2026 19:30

@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: 93c3f409c4

ℹ️ 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".

@HAYDEN-OAI HAYDEN-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 93c3f409c40fea3120ab835baf33c5c17e677250 across all seven changed files and the surrounding authentication, retry, copy, lifecycle, and TLS paths. The prerequisite #946 is now merged and included.

The existing withOptions transport/origin finding remains valid after an independent source-level check. Please address that existing thread before approval; I have not added a duplicate inline comment. No additional nonduplicate findings.

Validation was static source review only; I did not execute tests or live X.509 requests.

@HAYDEN-OAI HAYDEN-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 the complete seven-file PR and the material fix in c5ac1a1. The prior withOptions finding is addressed: synchronous and asynchronous authentication now validate the resolved destination before acquiring a token or attaching Authorization, independently of a replacement transport. I also inspected the public clone regressions and the surrounding fixed-alias TLS, cache/refresh, rejected-token retry, copy, and resource-lifecycle paths. No remaining actionable findings.

Validation was static source review; I did not execute tests or live X.509 requests.

@jbeckwith-oai
jbeckwith-oai added this pull request to the merge queue Aug 27, 2026
Merged via the queue into main with commit 9684d52 Aug 27, 2026
13 checks passed
@openai-sdks openai-sdks Bot mentioned this pull request Aug 27, 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