Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
966c365
feat(auth): use os keyring for secure credential storage
l2ysho May 19, 2026
603a086
fix(tests): await async getApifyClientOptions in test clients
l2ysho May 20, 2026
078d098
Merge branch 'master' into 1115-use-os-keyring-for-credential-storage
l2ysho May 20, 2026
b47629f
fix(auth): skip keyring probe when backend already chosen
l2ysho May 20, 2026
0e8c27c
fix(tests): pin e2e CLI subprocesses to file credential backend
l2ysho May 20, 2026
9479f48
fix(auth): always clear keyring entries on logout
l2ysho May 20, 2026
ecb4790
fix(auth): distinguish env-disabled keyring from probe failure in log…
l2ysho May 20, 2026
f9eaed9
fix(auth): keep proxy.password in auth.json, route only token through…
l2ysho May 20, 2026
6891911
wire up proxy.password
l2ysho May 20, 2026
79a983a
Align with mcpc
l2ysho May 20, 2026
e50795c
Merge branch 'master' into 1115-use-os-keyring-for-credential-storage
l2ysho May 28, 2026
385451f
refactor(credentials): break import cycle and defer keyring probe
l2ysho May 28, 2026
e3af68b
fix(tests): make runs abort e2e test resilient to fast-finishing actor
l2ysho May 28, 2026
81b0aca
Merge branch 'master' into 1115-use-os-keyring-for-credential-storage
l2ysho May 28, 2026
556f641
Merge branch 'master' into 1115-use-os-keyring-for-credential-storage
l2ysho May 28, 2026
4d4ec6c
Merge branch 'master' into 1115-use-os-keyring-for-credential-storage
l2ysho May 28, 2026
bef81c8
feat(auth): bundle-specific hint when OS keyring is unavailable
l2ysho May 29, 2026
faf9a41
Merge branch 'master' into 1115-use-os-keyring-for-credential-storage
l2ysho Jun 1, 2026
5c24f1c
Update src/lib/credentials.ts
l2ysho Jun 2, 2026
1daee77
Merge branch 'master' into 1115-use-os-keyring-for-credential-storage
l2ysho Jun 2, 2026
9380075
fix proxy spread and add test
l2ysho Jun 2, 2026
b90fa2f
Merge remote-tracking branch 'origin/1115-use-os-keyring-for-credenti…
l2ysho Jun 2, 2026
24cf143
refactor(auth): rename clearSecrets to clearKeyringSecrets
l2ysho Jun 2, 2026
8406367
migrates proxy password to the keyring when token is absent
l2ysho Jun 2, 2026
345ee8e
fix(auth): consolidate keyring migration writes into single try/catch
l2ysho Jun 2, 2026
744c7e0
refactor(auth): skip redundant credential overlay on file backend
l2ysho Jun 2, 2026
c5bd02f
refactor(auth): drop redundant cast on userInfo.proxy access
l2ysho Jun 2, 2026
b047dec
refactor(auth): preserve non-secret proxy fields on keyring backend w…
l2ysho Jun 2, 2026
e42d9e5
refactor(auth): use resolvedToken local instead of reassigning the pa…
l2ysho Jun 2, 2026
d5a9c11
refactor(auth): name the user-metadata check in getLocalUserInfo
l2ysho Jun 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"@inquirer/input": "^5.0.10",
"@inquirer/password": "^5.0.10",
"@inquirer/select": "^5.1.2",
"@napi-rs/keyring": "^1.3.0",
"@root/walk": "~1.1.0",
"@sapphire/duration": "^1.2.0",
"@sapphire/result": "^2.8.0",
Expand Down
135 changes: 135 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/commands/actors/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class ActorsSearchCommand extends ApifyCommand<typeof ActorsSearchCommand
const { query } = this.args;
const { json, sortBy, category, username, pricingModel, limit, offset } = this.flags;

const clientOptions = getApifyClientOptions();
const clientOptions = await getApifyClientOptions();
delete clientOptions.token;
const client = new ApifyClient(clientOptions);

Expand Down
17 changes: 16 additions & 1 deletion src/commands/auth/login.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Server } from 'node:http';
import type { AddressInfo } from 'node:net';
import process from 'node:process';

import chalk from 'chalk';
import computerName from 'computer-name';
Expand All @@ -12,6 +13,7 @@ import { cryptoRandomObjectId } from '@apify/utilities';
import { ApifyCommand } from '../../lib/command-framework/apify-command.js';
import { Flags } from '../../lib/command-framework/flags.js';
import { AUTH_FILE_PATH } from '../../lib/consts.js';
import { getBackend } from '../../lib/credentials.js';
import { updateUserId } from '../../lib/hooks/telemetry/useTelemetryState.js';
import { useMaskedInput } from '../../lib/hooks/user-confirmations/useMaskedInput.js';
import { useSelectFromList } from '../../lib/hooks/user-confirmations/useSelectFromList.js';
Expand All @@ -34,8 +36,21 @@ const tryToLogin = async (token: string) => {
if (isUserLogged) {
await updateUserId(userInfo.id!);

const backend = await getBackend();
let tokenLocation: string;
if (backend === 'keyring') {
tokenLocation = 'your OS keyring';
} else if (process.env.APIFY_DISABLE_KEYRING === '1') {
tokenLocation = `${AUTH_FILE_PATH()} (OS keyring disabled via APIFY_DISABLE_KEYRING)`;
} else if (process.env.APIFY_CLI_BUNDLE) {
// Bundle distributions ship without the OS keyring native module — see
// https://github.com/apify/apify-cli/issues for the tracking issue.
tokenLocation = `${AUTH_FILE_PATH()} (OS keyring not available in bundle installs; install via npm for keyring storage, or set APIFY_DISABLE_KEYRING=1 to silence)`;
} else {
tokenLocation = `${AUTH_FILE_PATH()} (OS keyring unavailable; set APIFY_DISABLE_KEYRING=1 to silence)`;
}
success({
message: `You are logged in to Apify as ${userInfo.username || userInfo.id}. ${chalk.gray(`Your token is stored at ${AUTH_FILE_PATH()}.`)}`,
message: `You are logged in to Apify as ${userInfo.username || userInfo.id}. ${chalk.gray(`Your token is stored in ${tokenLocation}.`)}`,
});
} else {
error({
Expand Down
2 changes: 2 additions & 0 deletions src/commands/auth/logout.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApifyCommand } from '../../lib/command-framework/apify-command.js';
import { AUTH_FILE_PATH } from '../../lib/consts.js';
import { clearKeyringSecrets } from '../../lib/credentials.js';
import { rimrafPromised } from '../../lib/files.js';
import { updateUserId } from '../../lib/hooks/telemetry/useTelemetryState.js';
import { success } from '../../lib/outputs.js';
Expand All @@ -24,6 +25,7 @@ export class AuthLogoutCommand extends ApifyCommand<typeof AuthLogoutCommand> {
static override docsUrl = 'https://docs.apify.com/cli/docs/reference#apify-logout';

async run() {
await clearKeyringSecrets();
await rimrafPromised(AUTH_FILE_PATH());

await updateUserId(null);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const getApifyStorageClient = async (
const apifyToken = await getApifyTokenFromEnvOrAuthFile();

return new ApifyClient({
...getApifyClientOptions(apifyToken),
...(await getApifyClientOptions(apifyToken)),
...options,
});
};
Expand Down
Loading
Loading