fix(auth): make login status recognize existing Codex authentication - #738
Open
Ultron09 wants to merge 1 commit into
Open
fix(auth): make login status recognize existing Codex authentication#738Ultron09 wants to merge 1 commit into
Ultron09 wants to merge 1 commit into
Conversation
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.
Summary
Fixes #670. When a user with an existing ambient Codex authentication session (e.g. in
~/.codex/auth.jsonor$CODEX_HOME/auth.json) rancodex-security login statusor invokedsecurity.account()on a fresh state directory, Codex Security reported "Not logged in".Ambient credentials were only imported during scan execution (via
initialCredentialsAvailable), creating an inconsistency wherelogin statusreported not logged in immediately before a scan succeeded using ChatGPT authentication.Changes
sdk/typescript/src/cli.ts: Whenargs.action === "status"andcredentialHomeexists, invokeinitialCredentialsAvailable(dependencies.environment, ambientHome, credentialHome)before executing Codexlogin status.sdk/typescript/src/api.ts: InCodexSecurity.prototype.account(), invokeinitialCredentialsAvailable(...)onauthentication.codexHomeprior to queryingaccountStatus().initialCredentialsAvailable()continues to enforcecodexSecurityCredentialAllowsAmbientImport(isolatedHome), ensuring ambient credentials are never re-imported if the user previously logged out.sdk/typescript/tests-ts/cli-authentication.test.tsandsdk/typescript/tests-ts/api-credentials.test.ts.Testing
Ran the following checks locally:
pnpm --dir sdk/typescript run types-> passed with 0 errorsbun test ./tests-ts/cli-authentication.test.ts ./tests-ts/auth.test.ts ./tests-ts/api-credentials.test.ts-> 43 passed, 2 skipped (platform-specific), 0 failedpnpm --dir sdk/typescript run format-> passed (all matched files use Prettier style)python .github/scripts/check_plugin_source_compatibility.py-> passedRisk and rollout
Public disclosure review