Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [1.1.77](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.77) - 2026-04-01

### Fixed
- Improved error message when using `--reach` with an invalid, expired, or revoked API token. Previously showed a misleading "Unable to verify plan permissions" error; now clearly indicates the authentication failure.

### Changed
- Updated the Coana CLI to v `14.12.201`.

## [1.1.74](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.74) - 2026-03-19

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "socket",
"version": "1.1.76",
"version": "1.1.77",
"description": "CLI for Socket.dev",
"homepage": "https://github.com/SocketDev/socket-cli",
"license": "MIT AND OFL-1.1",
Expand Down Expand Up @@ -97,7 +97,7 @@
"@babel/preset-typescript": "7.27.1",
"@babel/runtime": "7.28.4",
"@biomejs/biome": "2.2.4",
"@coana-tech/cli": "14.12.200",
"@coana-tech/cli": "14.12.201",
"@cyclonedx/cdxgen": "12.1.2",
"@dotenvx/dotenvx": "1.49.0",
"@eslint/compat": "1.3.2",
Expand Down
50 changes: 45 additions & 5 deletions pnpm-lock.yaml

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

5 changes: 5 additions & 0 deletions src/commands/organization/fetch-organization-list.mts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { logger } from '@socketsecurity/registry/lib/logger'

import { handleApiCall } from '../../utils/api.mts'
import { setupSdk } from '../../utils/sdk.mts'

Expand Down Expand Up @@ -54,6 +56,9 @@ export async function fetchOrganization(
silence,
})
if (!orgsCResult.ok) {
if (!silence) {
logger.fail(orgsCResult.message, orgsCResult.cause)
}
return orgsCResult
}

Expand Down
9 changes: 9 additions & 0 deletions src/commands/scan/perform-reachability-analysis.mts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ export async function performReachabilityAnalysis(
// Check if user has enterprise plan for reachability analysis.
const orgsCResult = await fetchOrganization()
if (!orgsCResult.ok) {
const httpCode = (orgsCResult.data as { code?: number } | undefined)?.code
if (httpCode === constants.HTTP_STATUS_UNAUTHORIZED) {
return {
ok: false,
message: 'Authentication failed',
cause:
'Your API token appears to be invalid, expired, or revoked. Please check your token and try again.',
}
}
return {
ok: false,
message: 'Unable to verify plan permissions',
Expand Down
5 changes: 4 additions & 1 deletion src/utils/api.mts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,10 @@ export async function getErrorMessageForHttpStatusCode(code: number) {
if (code === HTTP_STATUS_BAD_REQUEST) {
return 'One of the options passed might be incorrect'
}
if (code === HTTP_STATUS_FORBIDDEN || code === HTTP_STATUS_UNAUTHORIZED) {
if (code === HTTP_STATUS_UNAUTHORIZED) {
return 'Your Socket API token appears to be invalid, expired, or revoked. Please verify your token is correct and active'
}
if (code === HTTP_STATUS_FORBIDDEN) {
return 'Your Socket API token may not have the required permissions for this command or you might be trying to access (data from) an organization that is not linked to the API token you are logged in with'
}
if (code === HTTP_STATUS_NOT_FOUND) {
Expand Down
Loading