Skip to content

feat(auth): use os keyring for secure credential storage#1148

Draft
l2ysho wants to merge 10 commits into
masterfrom
1115-use-os-keyring-for-credential-storage
Draft

feat(auth): use os keyring for secure credential storage#1148
l2ysho wants to merge 10 commits into
masterfrom
1115-use-os-keyring-for-credential-storage

Conversation

@l2ysho
Copy link
Copy Markdown
Contributor

@l2ysho l2ysho commented May 20, 2026

Store sensitive API tokens and proxy passwords in OS keyring for improved security, falling back to file.

Store sensitive API tokens and proxy passwords in OS keyring for improved security, falling back to file.
@l2ysho l2ysho linked an issue May 20, 2026 that may be closed by this pull request
@github-actions github-actions Bot added this to the 141st sprint - Tooling team milestone May 20, 2026
@github-actions github-actions Bot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels May 20, 2026
@l2ysho l2ysho added t-dx Issues owned by the DX team. and removed t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels May 20, 2026
getApifyClientOptions became async but several test sites still passed
the returned Promise directly to `new ApifyClient(...)`, leaving the
client with undefined token/baseUrl.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label May 20, 2026
l2ysho and others added 8 commits May 20, 2026 13:35
Persist the backend marker in auth.json on first login and honor it on
subsequent runs so we don't re-probe the OS keyring on every CLI
invocation. Also drop the write/delete side of the probe — getPassword
on a non-existent entry is enough to detect an unavailable backend and
avoids unnecessary Keychain access.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The OS keyring is machine-global, so the unique
__APIFY_INTERNAL_TEST_AUTH_PATH__ per test only isolates auth.json, not
the keyring. After one test logged in, the leaked token made later
tests see getToken() return a value with no matching username/id and
throw "Corrupted local user info". useAuthSetup already pins in-process
tests to the file backend; do the same for the dist subprocesses
runCli spawns.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Previously, clearSecrets() was a no-op when the active backend was
'file', so a user who logged in normally and later set
APIFY_DISABLE_KEYRING=1 before running logout would leave their token
in the OS keyring with no in-CLI way to remove it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…in message

When the user explicitly opts out via APIFY_DISABLE_KEYRING=1, calling
the keyring "unavailable" and telling them to set the var they already
set is misleading. Split the file-backend branch into two: env-disabled
vs probe failure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… keyring

Scoping the keyring change down: stripping the entire proxy object from
the userInfo write in getLoggedClient also dropped proxy.groups, which
breaks the log_in_out API test that compares auth.json to the API user
response. Leave proxy in the file as it was before and exclude the
internal secretsBackend marker from the test comparison.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-dx Issues owned by the DX team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use OS keyring for credential storage

2 participants