Skip to content

Conversation

@celia-oai
Copy link
Contributor

@celia-oai celia-oai commented Oct 26, 2025

This PR is a follow-up to #5591. It allows users to choose which auth storage mode they want by using the new cli_auth_credentials_store_mode config.

@celia-oai celia-oai force-pushed the dev/cc/set-auth-storage-based-on-config branch 6 times, most recently from ebf396f to ff93451 Compare October 27, 2025 05:07
@celia-oai celia-oai marked this pull request as ready for review October 27, 2025 05:17
@celia-oai celia-oai changed the title [Draft][Auth] Choose which auth storage to use based on config Oct 27, 2025
@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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".

/// keyring: Use an OS-specific keyring service.
/// file: Use a file in the Codex home directory.
/// auto (default): Use the OS-specific keyring service if available, otherwise use a file.
pub cli_auth_credentials_store_mode: AuthCredentialsStoreMode,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a setting?

Copy link
Contributor Author

@celia-oai celia-oai Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to keep the setting as file as default for now so it is compatible with current behavior (esp. in headless and sandboxed setups). This config gives users with higher security requirements the ability to config keyring-only mode. I don't expect keyring-only to ever be the default because of the diverse environments Codex is run in, so there will always be environments where keyring-only won't work.

@celia-oai celia-oai force-pushed the dev/cc/auth-keyring-support branch 5 times, most recently from 2b06a08 to 72ccf34 Compare October 27, 2025 18:10
@celia-oai celia-oai force-pushed the dev/cc/set-auth-storage-based-on-config branch 3 times, most recently from 1d38545 to d849e28 Compare October 27, 2025 19:01
Base automatically changed from dev/cc/auth-keyring-support to main October 27, 2025 19:10
@celia-oai celia-oai force-pushed the dev/cc/set-auth-storage-based-on-config branch 2 times, most recently from c9b7ecb to e6b55bf Compare October 27, 2025 20:28
@celia-oai celia-oai requested a review from pakrym-oai October 27, 2025 20:34
- `keyring` – Store credentials in the operating system keyring via the [`keyring` crate](https://crates.io/crates/keyring); the CLI reports an error if secure storage is unavailable. Backends by OS:
- macOS: macOS Keychain
- Windows: Windows Credential Manager
- Linux: DBus‑based Secret Service, the kernel keyutils, or a combination
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, if you open the link of doc it has a section talking about this:

Platforms
This crate provides built-in implementations of the following platform-specific credential stores:

Linux: The DBus-based Secret Service, the kernel keyutils, and a combo of the two.
FreeBSD, OpenBSD: The DBus-based Secret Service.
macOS, iOS: The local keychain.
Windows: The Windows Credential Manager.

Copy link
Contributor Author

@celia-oai celia-oai Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, let me also turn on the features in Cargo.toml that correspond to this doc

}
SlashCommand::Logout => {
if let Err(e) = codex_core::auth::logout(&self.config.codex_home) {
if let Err(e) = codex_core::auth::logout(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surprised this is not an auth_manager call

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could maybe do a sweep of tech debt like this at some point as a follow-up to unify auth workflow. Right now it's a bit painful to do the refactor because there are many custom workflows like this.

error: None,
sign_in_state: Arc::new(RwLock::new(SignInState::PickMode)),
codex_home: codex_home.clone(),
cli_auth_credentials_store_mode,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who else needs this? Would be nice to encapsulate all logic in AuthManager

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@celia-oai celia-oai force-pushed the dev/cc/set-auth-storage-based-on-config branch from 8f241a1 to 8e5f8f2 Compare October 27, 2025 23:36
@celia-oai celia-oai force-pushed the dev/cc/set-auth-storage-based-on-config branch from 6fd7241 to b752a20 Compare October 28, 2025 01:15
@celia-oai celia-oai merged commit 4a42c4e into main Oct 28, 2025
34 of 36 checks passed
@celia-oai celia-oai deleted the dev/cc/set-auth-storage-based-on-config branch October 28, 2025 02:41
@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants