
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
The Socket Security CLI was created to enable integrations with other tools like GitHub Actions, GitLab, BitBucket, local use cases and more. The tool will get the head scan for the provided repo from Socket, create a new one, and then report any new alerts detected. If there are new alerts against the Socket security policy it'll exit with a non-Zero exit code.
The CLI now features automatic detection of git repository information, making it much simpler to use in CI/CD environments. Most parameters are now optional and will be detected automatically from your git repository.
GitHub Actions:
socketcli --target-path $GITHUB_WORKSPACE --scm github --pr-number $PR_NUMBER
GitLab CI:
socketcli --target-path $CI_PROJECT_DIR --scm gitlab --pr-number ${CI_MERGE_REQUEST_IID:-0}
Local Development:
socketcli --target-path ./my-project
The CLI will automatically detect:
Pre-configured workflow examples are available in the workflows/
directory:
These examples are production-ready and include best practices for each platform.
socketcli [-h] [--api-token API_TOKEN] [--repo REPO] [--integration {api,github,gitlab}] [--owner OWNER] [--branch BRANCH]
[--committers [COMMITTERS ...]] [--pr-number PR_NUMBER] [--commit-message COMMIT_MESSAGE] [--commit-sha COMMIT_SHA]
[--target-path TARGET_PATH] [--sbom-file SBOM_FILE] [--files FILES] [--save-submitted-files-list SAVE_SUBMITTED_FILES_LIST]
[--default-branch] [--pending-head] [--generate-license] [--enable-debug] [--enable-json] [--enable-sarif]
[--disable-overview] [--disable-security-issue] [--allow-unverified] [--ignore-commit-files] [--disable-blocking]
[--scm SCM] [--timeout TIMEOUT] [--exclude-license-details]
If you don't want to provide the Socket API Token every time then you can use the environment variable SOCKET_SECURITY_API_KEY
Parameter | Required | Default | Description |
---|---|---|---|
--api-token | False | Socket Security API token (can also be set via SOCKET_SECURITY_API_KEY env var) |
Parameter | Required | Default | Description |
---|---|---|---|
--repo | False | auto | Repository name in owner/repo format (auto-detected from git remote) |
--integration | False | api | Integration type (api, github, gitlab) |
--owner | False | Name of the integration owner, defaults to the socket organization slug | |
--branch | False | auto | Branch name (auto-detected from git) |
--committers | False | auto | Committer(s) to filter by (auto-detected from git commit) |
--repo-is-public | False | False | If set, flags a new repository creation as public. Defaults to false. |
Parameter | Required | Default | Description |
---|---|---|---|
--pr-number | False | "0" | Pull request number |
--commit-message | False | auto | Commit message (auto-detected from git) |
--commit-sha | False | auto | Commit SHA (auto-detected from git) |
Parameter | Required | Default | Description |
---|---|---|---|
--target-path | False | ./ | Target path for analysis |
--sbom-file | False | SBOM file path | |
--files | False | auto | Files to analyze (JSON array string). Auto-detected from git commit changes when not specified |
--excluded-ecosystems | False | [] | List of ecosystems to exclude from analysis (JSON array string). You can get supported files from the Supported Files API |
--license-file-name | False | license_output.json | Name of the file to save the license details to if enabled |
--save-submitted-files-list | False | Save list of submitted file names to JSON file for debugging purposes | |
--save-manifest-tar | False | Save all manifest files to a compressed tar.gz archive with original directory structure |
Parameter | Required | Default | Description |
---|---|---|---|
--default-branch | False | auto | Make this branch the default branch (auto-detected from git and CI environment when not specified) |
--pending-head | False | auto | If true, the new scan will be set as the branch's head scan (automatically synced with default-branch) |
Parameter | Required | Default | Description |
---|---|---|---|
--generate-license | False | False | Generate license information |
--enable-debug | False | False | Enable debug logging |
--enable-json | False | False | Output in JSON format |
--enable-sarif | False | False | Enable SARIF output of results instead of table or JSON format |
--disable-overview | False | False | Disable overview output |
--exclude-license-details | False | False | Exclude license details from the diff report (boosts performance for large repos) |
Parameter | Required | Default | Description |
---|---|---|---|
--allow-unverified | False | False | Allow unverified packages |
--disable-security-issue | False | False | Disable security issue checks |
Parameter | Required | Default | Description |
---|---|---|---|
--ignore-commit-files | False | False | Ignore commit files |
--disable-blocking | False | False | Disable blocking mode |
--scm | False | api | Source control management type |
--timeout | False | Timeout in seconds for API requests | |
--include-module-folders | False | False | If enabled will include manifest files from folders like node_modules |
The Python CLI currently Supports the following plugins:
Environment Variable | Required | Default | Description |
---|---|---|---|
SOCKET_JIRA_ENABLED | False | false | Enables/Disables the Jira Plugin |
SOCKET_JIRA_CONFIG_JSON | True | None | Required if the Plugin is enabled. |
Example SOCKET_JIRA_CONFIG_JSON
value
{"url": "https://REPLACE_ME.atlassian.net", "email": "example@example.com", "api_token": "REPLACE_ME", "project": "REPLACE_ME" }
Environment Variable | Required | Default | Description |
---|---|---|---|
SOCKET_SLACK_ENABLED | False | false | Enables/Disables the Slack Plugin |
SOCKET_SLACK_CONFIG_JSON | True | None | Required if the Plugin is enabled. |
Example SOCKET_SLACK_CONFIG_JSON
value
{"url": "https://REPLACE_ME_WEBHOOK"}
The CLI now automatically detects repository information from your git environment, significantly simplifying usage in CI/CD pipelines:
The CLI uses intelligent default branch detection with the following priority:
--default-branch
flag: Takes highest priority when specifiedfalse
if none of the above methods succeedBoth --default-branch
and --pending-head
parameters are automatically synchronized to ensure consistent behavior.
The CLI determines scanning behavior intelligently:
The CLI determines which files to scan based on the following logic:
Git Commit Files (Default): The CLI automatically checks files changed in the current git commit. If any of these files match supported manifest patterns (like package.json, requirements.txt, etc.), a scan is triggered.
--files
Parameter Override: When specified, this parameter takes precedence over git commit detection. It accepts a JSON array of file paths to check for manifest files.
--ignore-commit-files
Flag: When set, git commit files are ignored completely, and the CLI will scan all manifest files in the target directory regardless of what changed.
Automatic Fallback: If no manifest files are found in git commit changes and no --files
are specified, the CLI automatically switches to "API mode" and performs a full repository scan.
Important: The CLI doesn't scan only the specified files - it uses them to determine whether a scan should be performed and what type of scan to run. When triggered, it searches the entire
--target-path
for all supported manifest files.
--ignore-commit-files
, always performs a full scan regardless of changespackage.json
, a differential scan will be triggered automatically with PR comment integration..github/workflows/socket.yaml
), the CLI automatically switches to API mode and performs a full repository scan.--files
: If you specify --files '["package.json"]'
, the CLI will check if this file exists and is a manifest file before determining scan type.--ignore-commit-files
: This forces a full scan of all manifest files in the target path, regardless of what's in your commit.socketcli --target-path /path/to/repo --scm github --pr-number $PR_NUM
The CLI provides a debugging option to save the list of files that were submitted for scanning:
socketcli --save-submitted-files-list submitted_files.json
This will create a JSON file containing:
Example output file:
{
"timestamp": "2025-01-22 10:30:45 UTC",
"total_files": 3,
"total_size_bytes": 2048,
"total_size_human": "2.00 KB",
"files": [
"./package.json",
"./requirements.txt",
"./Pipfile"
]
}
This feature is useful for:
Note: This option works with both differential scans (when git commits are detected) and full scans (API mode).
For backup, sharing, or analysis purposes, you can save all manifest files to a compressed tar.gz archive:
socketcli --save-manifest-tar manifest_files.tar.gz
This will create a compressed archive containing all the manifest files that were found and submitted for scanning, preserving their original directory structure relative to the scanned directory.
Example usage with other options:
# Save both files list and archive
socketcli --save-submitted-files-list files.json --save-manifest-tar backup.tar.gz
# Use with specific target path
socketcli --target-path ./my-project --save-manifest-tar my-project-manifests.tar.gz
The manifest archive feature is useful for:
Note: The tar.gz archive preserves the original directory structure, making it easy to extract and examine the files in their proper context.
This project uses pyproject.toml
as the primary dependency specification.
The following Make targets provide streamlined workflows for common development tasks:
pyenv local 3.11 # Ensure correct Python version
make first-time-setup
pyenv local 3.11 # Ensure correct Python version
SOCKET_SDK_PATH=~/path/to/socket-sdk-python make first-time-local-setup
The default SDK path is ../socket-sdk-python
if not specified.
After changing dependencies in pyproject.toml:
make update-deps
After pulling changes:
make sync-all
High-level workflows:
make first-time-setup
: Complete setup using PyPI packagesmake first-time-local-setup
: Complete setup for local SDK developmentmake update-deps
: Update requirements.txt files and sync dependenciesmake sync-all
: Sync dependencies after pulling changesmake dev-setup
: Setup for local development (included in first-time-local-setup)Implementation targets:
make init-tools
: Creates virtual environment and installs pip-toolsmake local-dev
: Installs dependencies needed for local developmentmake compile-deps
: Generates requirements.txt files with locked versionsmake setup
: Creates virtual environment and installs dependenciesmake sync-deps
: Installs exact versions from requirements.txtmake clean
: Removes virtual environment and cache filesmake test
: Runs pytest suitemake lint
: Runs ruff for code formatting and lintingSOCKET_SDK_PATH
: Path to local socket-sdk-python repository (default: ../socket-sdk-python)FAQs
Socket Security CLI for CI/CD
We found that socketsecurity demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.