CLI for Socket.dev security analysis
Install via package manager:
pnpm install -g socket
socket --helpOr install via npm:
npm install -g socket
socket --helpsocket npm [args...]/socket npx [args...]- Wrap npm/npx with security scanningsocket pnpm [args...]/socket yarn [args...]- Wrap pnpm/yarn with security scanningsocket pip [args...]- Wrap pip with security scanningsocket scan- Create and manage security scanssocket package <name>- Analyze package security scoressocket fix- Fix CVEs in dependenciessocket optimize- Optimize dependencies with@socketregistryoverridessocket manifest [command]- Generate and manage SBOMs for multiple ecosystemssocket cdxgen [command]- Alias forsocket manifest cdxgen- Run cdxgen for SBOM generation
socket organization(alias:org) - Manage organization settingssocket repository(alias:repo) - Manage repositoriessocket dependencies(alias:deps) - View organization dependenciessocket audit-log(alias:audit) - View audit logssocket analytics- View organization analyticssocket threat-feed(alias:feed) - View threat intelligence
socket login- Authenticate with Socket.devsocket logout- Remove authenticationsocket whoami- Show authenticated usersocket config- Manage CLI configuration
All aliases support the flags and arguments of the commands they alias.
socket ci- Alias forsocket scan create --report(creates report and exits with error if unhealthy)socket org- Alias forsocket organizationsocket repo- Alias forsocket repositorysocket pkg- Alias forsocket packagesocket deps- Alias forsocket dependenciessocket audit- Alias forsocket audit-logsocket feed- Alias forsocket threat-feed
These flags are available on data-retrieval commands (scan, package, organization, etc.):
--json- Output as JSON--markdown- Output as Markdown
--dry-run- Run without uploading--help- Show help--version- Show version
Socket CLI reads socket.yml configuration files.
Supports version 2 format with projectIgnorePaths for excluding files from reports.
GITHUB_API_URL- GitHub API base URL (default:https://api.github.com, set for GitHub Enterprise)SOCKET_CLI_ACCEPT_RISKS- Accept npm/npx risksSOCKET_CLI_API_BASE_URL- Override Socket API endpoint (default:api.socket.dev)SOCKET_CLI_API_PROXY- HTTP proxy for API callsSOCKET_CLI_API_TIMEOUT- API request timeout in millisecondsSOCKET_CLI_API_TOKEN- Socket API tokenSOCKET_CLI_BIN_PATH- Path to CLI binarySOCKET_CLI_BOOTSTRAP_CACHE_DIR- Bootstrap cache directorySOCKET_CLI_BOOTSTRAP_SPEC- Bootstrap specificationSOCKET_CLI_CDXGEN_LOCAL_PATH- Local path to cdxgen toolSOCKET_CLI_COANA_LOCAL_PATH- Local path to Coana toolSOCKET_CLI_CONFIG- JSON configuration objectSOCKET_CLI_DEBUG- Enable debug logging (set to1)SOCKET_CLI_FIX- Enable fix modeSOCKET_CLI_GIT_USER_EMAIL- Git user email (default:github-actions[bot]@users.noreply.github.com)SOCKET_CLI_GIT_USER_NAME- Git user name (default:github-actions[bot])SOCKET_CLI_GITHUB_TOKEN- GitHub token with repo access (GITHUB_TOKENandGH_TOKENalso recognized as fallbacks)SOCKET_CLI_JS_PATH- Path to JavaScript runtimeSOCKET_CLI_LOCAL_NODE_SMOL- Path to local node-smol binarySOCKET_CLI_LOCAL_PATH- Local CLI pathSOCKET_CLI_MODE- CLI operation modeSOCKET_CLI_MODELS_PATH- Path to AI modelsSOCKET_CLI_NO_API_TOKEN- Disable default API tokenSOCKET_CLI_NPM_PATH- Path to npm directorySOCKET_CLI_OPTIMIZE- Enable optimize modeSOCKET_CLI_ORG_SLUG- Socket organization slugSOCKET_CLI_PYCLI_LOCAL_PATH- Local path to Python CLI toolSOCKET_CLI_PYTHON_PATH- Path to Python interpreterSOCKET_CLI_SEA_NODE_VERSION- Node version for SEA buildsSOCKET_CLI_SFW_LOCAL_PATH- Local path to SFW toolSOCKET_CLI_SKIP_UPDATE_CHECK- Disable update checkingSOCKET_CLI_SOCKET_PATCH_LOCAL_PATH- Local path to socket-patch toolSOCKET_CLI_VIEW_ALL_RISKS- Show all npm/npx risks
Setup instructions:
git clone https://github.com/SocketDev/socket-cli.git
cd socket-cli
pnpm install
pnpm run build
pnpm testDevelopment commands:
pnpm run build # Smart build
pnpm run build --force # Force rebuildDebug logging:
SOCKET_CLI_DEBUG=1 socket <command> # Enable debug output
DEBUG=network socket <command> # Specific category