fix: support encrypted local secrets for keyring auth - #17931
Closed
mikhail-oai wants to merge 20 commits into
Closed
fix: support encrypted local secrets for keyring auth#17931mikhail-oai wants to merge 20 commits into
mikhail-oai wants to merge 20 commits into
Conversation
Contributor
|
Closing this pull request because it has had no updates for more than 14 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
celia-oai
force-pushed
the
codex/keyring-mode-encrypted-auth
branch
2 times, most recently
from
May 18, 2026 05:32
ee4e093 to
63482e2
Compare
celia-oai
force-pushed
the
codex/keyring-mode-encrypted-auth
branch
25 times, most recently
from
May 26, 2026 23:02
2c08a84 to
7b0d612
Compare
Co-authored-by: viyatb-oai <viyatb@openai.com>
celia-oai
force-pushed
the
codex/keyring-mode-encrypted-auth
branch
from
June 11, 2026 00:47
295d319 to
95b6f6f
Compare
celia-oai
force-pushed
the
codex/secret-auth-storage-config
branch
from
June 12, 2026 18:53
683a9f4 to
3e3379b
Compare
celia-oai
added a commit
that referenced
this pull request
Jun 12, 2026
## Why Windows Credential Manager limits generic credential blobs to 2,560 bytes. The encrypted local secrets backend avoids storing large serialized auth payloads directly in the OS keyring, but selecting that backend needs an independently reviewable feature/config layer before the auth and secrets implementation is wired in. ## What Changed - Added the stable `secret_auth_storage` feature, enabled by default on Windows and disabled by default elsewhere. - Added `AuthKeyringBackendKind` and config resolution for full and bootstrap config loading. - Applied managed feature requirements when resolving the bootstrap auth backend. - Updated the generated config schema and added focused tests. This is the base PR for #17931. The auth, secrets, MCP, CLI, TUI, and app-server implementation remains in that follow-up PR. ## Validation - `just test -p codex-features` - `just test -p codex-config` - `just test -p codex-core resolve_bootstrap_auth_keyring_backend_kind_uses_secret_auth_storage_feature` - `just write-config-schema` - `just fix -p codex-core` The full `just test -p codex-core` run compiled successfully and ran 2,690 tests; 2,589 passed, one was flaky, and 101 environment-sensitive tests failed because this shell injects a `pyenv` rehash warning into command output or because sandboxed subprocesses timed out.
Contributor
|
this has been merged with the PR stack ending in #27541. |
celia-oai
added a commit
that referenced
this pull request
Jun 12, 2026
## Summary - store MCP OAuth credentials in the configured auth credential backend - support encrypted-local OAuth storage, including legacy keyring migration - propagate the credential backend through MCP refresh, session, CLI, and app-server paths ## Stack 1. #27504 — config and feature flag 2. #27535 — auth-specific secret namespaces 3. #27539 — encrypted CLI auth storage 4. this PR — encrypted MCP OAuth storage This is a parallel review stack; the original #17931 remains unchanged. ## Tests - `just test -p codex-rmcp-client` (the transport round-trip test passed after building the required `codex` binary and retrying) - `just test -p codex-mcp` - `just test -p codex-app-server refresh_config_uses_latest_auth_keyring_backend` - `just test -p codex-core refresh_mcp_servers_is_deferred_until_next_turn` - `just test -p codex-cli mcp` - `just fix -p codex-rmcp-client -p codex-mcp -p codex-core -p codex-cli -p codex-app-server -p codex-protocol` - `just bazel-lock-check`
wangjiecloud
pushed a commit
to wangjiecloud/codex
that referenced
this pull request
Jun 27, 2026
## Why Windows Credential Manager limits generic credential blobs to 2,560 bytes. The encrypted local secrets backend avoids storing large serialized auth payloads directly in the OS keyring, but selecting that backend needs an independently reviewable feature/config layer before the auth and secrets implementation is wired in. ## What Changed - Added the stable `secret_auth_storage` feature, enabled by default on Windows and disabled by default elsewhere. - Added `AuthKeyringBackendKind` and config resolution for full and bootstrap config loading. - Applied managed feature requirements when resolving the bootstrap auth backend. - Updated the generated config schema and added focused tests. This is the base PR for openai#17931. The auth, secrets, MCP, CLI, TUI, and app-server implementation remains in that follow-up PR. ## Validation - `just test -p codex-features` - `just test -p codex-config` - `just test -p codex-core resolve_bootstrap_auth_keyring_backend_kind_uses_secret_auth_storage_feature` - `just write-config-schema` - `just fix -p codex-core` The full `just test -p codex-core` run compiled successfully and ran 2,690 tests; 2,589 passed, one was flaky, and 101 environment-sensitive tests failed because this shell injects a `pyenv` rehash warning into command output or because sandboxed subprocesses timed out.
wangjiecloud
pushed a commit
to wangjiecloud/codex
that referenced
this pull request
Jun 27, 2026
## Summary - store MCP OAuth credentials in the configured auth credential backend - support encrypted-local OAuth storage, including legacy keyring migration - propagate the credential backend through MCP refresh, session, CLI, and app-server paths ## Stack 1. openai#27504 — config and feature flag 2. openai#27535 — auth-specific secret namespaces 3. openai#27539 — encrypted CLI auth storage 4. this PR — encrypted MCP OAuth storage This is a parallel review stack; the original openai#17931 remains unchanged. ## Tests - `just test -p codex-rmcp-client` (the transport round-trip test passed after building the required `codex` binary and retrying) - `just test -p codex-mcp` - `just test -p codex-app-server refresh_config_uses_latest_auth_keyring_backend` - `just test -p codex-core refresh_mcp_servers_is_deferred_until_next_turn` - `just test -p codex-cli mcp` - `just fix -p codex-rmcp-client -p codex-mcp -p codex-core -p codex-cli -p codex-app-server -p codex-protocol` - `just bazel-lock-check`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Windows Credential Manager limits a generic credential blob to 2,560 bytes. Large ChatGPT auth payloads, and MCP OAuth token payloads in the same keyring-backed storage path, can exceed that limit and make keyring persistence fail on Windows.
This PR keeps keyring-backed auth secure without requiring those large serialized payloads to fit directly in the OS credential entry. Instead, Windows can store the payload in Codex's encrypted local secrets backend while keeping the local secrets key in the OS keyring. Non-Windows platforms continue to use direct keyring storage by default. Goal is to move everything to the secrets keyring path and deprecate the old path after it's fully validated.
What Changed
AuthKeyringBackendKindand asecret_auth_storagefeature that selects between direct keyring storage and encrypted local-secrets-backed keyring storage. The feature is enabled by default on Windows.codex doctorpaths to use the configured keyring backend.AuthDotJson, removes stale fallbackauth.jsondata after successful saves, and deletes both encrypted and fallback auth on logout.Validation
Manual macOS/Windows validation with
cli_auth_credentials_store = "auto",mcp_oauth_credentials_store = "auto", andfeatures.secret_auth_storage = true:codexand accountsecrets|....$CODEX_HOME/secrets/local.agewithout printing secret values, confirming one CLI auth entry and MCP OAuth entries are present:global/CLI_AUTHglobal/MCP_OAUTH_...Also validated that the feature flag is default on for windows and default off for macOS.
#closes #10353