Skip to content

Commit ba4e16a

Browse files
committed
Fix incorrect token usage in /v0/purl requests
When getAlertsMapFromPurls is called without an explicit apiToken option, it was defaulting to getPublicApiToken() which always returns the public token as a fallback. This caused /v0/purl API requests to use the public token even when SOCKET_CLI_API_TOKEN was set in the environment. The fix removes the default value and lets setupSdk handle token resolution through getDefaultApiToken(), which properly respects SOCKET_CLI_API_TOKEN and other token sources.
1 parent b315e9a commit ba4e16a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils/alerts-map.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { isNonEmptyString } from '@socketsecurity/registry/lib/strings'
2727
import { findSocketYmlSync } from './config.mts'
2828
import { toFilterConfig } from './filter-config.mts'
2929
import { extractPurlsFromPnpmLockfile } from './pnpm.mts'
30-
import { getPublicApiToken, setupSdk } from './sdk.mts'
30+
import { setupSdk } from './sdk.mts'
3131
import { addArtifactToAlertsMap } from './socket-package-alert.mts'
3232

3333
import type { CompactSocketArtifact } from './alert/artifact.mts'
@@ -91,7 +91,7 @@ export async function getAlertsMapFromPurls(
9191
opts.filter.fixable = true
9292
}
9393

94-
const { apiToken = getPublicApiToken(), spinner } = opts
94+
const { apiToken, spinner } = opts
9595

9696
const getText = () => `Looking up data for ${remaining} packages`
9797

0 commit comments

Comments
 (0)