Skip to content

feat: use encrypted local secrets for CLI auth - #27539

Merged
celia-oai merged 4 commits into
mainfrom
codex/encrypted-cli-auth-storage
Jun 12, 2026
Merged

feat: use encrypted local secrets for CLI auth#27539
celia-oai merged 4 commits into
mainfrom
codex/encrypted-cli-auth-storage

Conversation

@celia-oai

Copy link
Copy Markdown
Contributor

Why

Windows Credential Manager limits generic credential blobs to 2,560 bytes. Large serialized ChatGPT auth payloads can exceed that limit, so keyring-mode CLI auth needs a backend that keeps only the encryption key in the OS keyring and stores the payload in Codex's encrypted local-secrets file.

This is the third PR in the encrypted-auth stack:

  1. feat: add secret auth storage configuration #27504 — feature and config selection
  2. feat: add auth-specific encrypted secret namespaces #27535 — auth-specific local-secrets namespaces
  3. This PR — CLI auth implementation and activation
  4. MCP OAuth implementation and activation

What Changed

  • Added encrypted CLI-auth storage using the CliAuth secrets namespace.
  • Preserved direct keyring storage for platforms/configurations where it remains selected.
  • Selected the backend consistently for login, logout, refresh, device-code login, auth loading, and login restrictions.
  • Threaded resolved bootstrap/full config through CLI, exec, TUI, app-server account handling, cloud config, and cloud tasks.
  • Removed stale auth.json fallback data after successful encrypted saves and removed encrypted, direct-keyring, and fallback data during logout.
  • Added storage and integration coverage for both direct and encrypted keyring modes.

MCP OAuth persistence is intentionally left to the next PR.

Validation

  • just test -p codex-login — 131 passed
  • just test -p codex-cli — 280 passed
  • just test -p codex-app-server v2::account — 25 passed
  • just test -p codex-cloud-config service — 21 passed, 7 skipped
  • just fix -p codex-login
  • just fix -p codex-cli
  • just fmt

@celia-oai
celia-oai marked this pull request as ready for review June 11, 2026 04:54
@celia-oai
celia-oai requested a review from a team as a code owner June 11, 2026 04:54
@celia-oai celia-oai changed the title Use encrypted local secrets for CLI auth feat: use encrypted local secrets for CLI auth Jun 11, 2026
@celia-oai
celia-oai requested a review from aibrahim-oai June 11, 2026 04:58

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

.feature_requirements
.clone(),
)?;
Ok(auth_keyring_backend_kind_from_secret_auth_storage(
managed_features.enabled(Feature::SecretAuthStorage),

P1 Badge Resolve cloud-managed secret auth before selecting Direct

When secret_auth_storage is only in the cloud bundle, this bootstrap stack lacks that requirement, so restart selects Direct before auth can fetch the bundle. Auth saved in encrypted Secrets by a prior full-config run is then invisible and users resume unauthenticated. guidance

ℹ️ 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 codex-rs/login/src/auth/storage.rs
Comment thread codex-rs/login/src/auth/storage.rs Outdated
@celia-oai
celia-oai force-pushed the codex/secret-auth-storage-namespaces branch from 53c24ac to e026ff2 Compare June 12, 2026 18:58
Base automatically changed from codex/secret-auth-storage-namespaces to main June 12, 2026 19:52
@celia-oai
celia-oai force-pushed the codex/encrypted-cli-auth-storage branch 3 times, most recently from 2881d21 to b8c2e75 Compare June 12, 2026 20:51
@celia-oai
celia-oai enabled auto-merge (squash) June 12, 2026 20:55
@celia-oai
celia-oai force-pushed the codex/encrypted-cli-auth-storage branch from b8c2e75 to d43079b Compare June 12, 2026 20:58
@celia-oai
celia-oai merged commit 56c97e3 into main Jun 12, 2026
31 checks passed
@celia-oai
celia-oai deleted the codex/encrypted-cli-auth-storage branch June 12, 2026 21:23
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants