CLI for Socket.dev security analysis
Install via curl:
curl -fsSL https://raw.githubusercontent.com/SocketDev/socket-cli/main/install.sh | bashOr install via package manager:
pnpm 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 cdxgen [command]- 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
--json- Output as JSON--markdown- Output as Markdown
--dry-run- Run without uploading--debug- Show debug output--help- Show help--max-old-space-size- Set Node.js memory limit--max-semi-space-size- Set Node.js heap size--version- Show version
Socket CLI reads socket.yml configuration files.
Supports version 2 format with projectIgnorePaths for excluding files from reports.
SOCKET_CLI_API_TOKEN- Socket API tokenSOCKET_CLI_CONFIG- JSON configuration objectSOCKET_CLI_GITHUB_API_URL- GitHub API base URLSOCKET_CLI_GIT_USER_EMAIL- Git user email (default:94589996+socket-bot@users.noreply.github.com)SOCKET_CLI_GIT_USER_NAME- Git user name (default:Socket Bot)SOCKET_CLI_GITHUB_TOKEN- GitHub token with repo access (alias:GITHUB_TOKEN)SOCKET_CLI_NO_API_TOKEN- Disable default API tokenSOCKET_CLI_NPM_PATH- Path to npm directorySOCKET_CLI_ORG_SLUG- Socket organization slugSOCKET_CLI_ACCEPT_RISKS- Accept npm/npx risksSOCKET_CLI_VIEW_ALL_RISKS- Show all npm/npx risks
See Getting Started for setup instructions.
git clone https://github.com/SocketDev/socket-cli.git
cd socket-cli
pnpm install
pnpm run build
pnpm testFor local dependency linking, see Development Linking.
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