Skip to main content
The CybeDefend CLI provides an efficient way to run local code scans and view results on our platform. It supports Linux, macOS, and Windows and is easily integrated into CI/CD pipelines or used in offline environments.

Usage

Installation

You can install the CybeDefend CLI using one of the following methods:

1. Pre-built Binaries

Supported Platforms:
  • macOS: cybedefend-darwin-amd64 (Intel) or cybedefend-darwin-arm64 (Apple Silicon M1/M2)
  • Linux: cybedefend-linux-amd64 (64-bit) or cybedefend-linux-386 (32-bit)
  • Windows: cybedefend-windows-amd64.exe (64-bit) or cybedefend-windows-386.exe (32-bit)
Installation Steps:
  1. Download the latest release for your platform from the GitHub Releases page
  2. Make Executable (Linux/macOS):
  3. Move to PATH:
  4. Verify Installation:

2. Build from Source

3. Docker Image

A pre-built Docker image is available on GitHub Container Registry:

Authentication

The CLI supports two authentication modes. Both store credentials in ~/.cybedefend/credentials.json and are picked up automatically by subsequent commands.
Opens the CybeDefend login page in your default browser. After completing authentication, the CLI stores your session automatically. Access tokens are refreshed transparently when they expire.
Validates your Personal Access Token and saves it locally. All subsequent commands use it automatically.

Environment Variable (no login step)

For CI/CD environments, skip cybedefend login entirely and set the PAT as an environment variable:

Credential Priority Order

  1. --pat flag (highest priority)
  2. CYBEDEFEND_PAT environment variable
  3. pat field in config file
  4. Stored credentials from cybedefend login

Logout

Deletes ~/.cybedefend/credentials.json and clears the stored session.
Deprecated: The --api-key flag has been removed. API Keys are no longer supported.

Configuration

Config File (config.yaml in ./, $HOME/.cybedefend, or /etc/cybedefend):
Environment Variables:
  • CYBEDEFEND_API_URL - API base URL
  • CYBEDEFEND_REGION - Platform region (us or eu). Ignored if CYBEDEFEND_API_URL is set
  • CYBEDEFEND_PAT - Personal Access Token (PAT) for authentication
  • CYBEDEFEND_PROJECT_ID - Default project ID
Command-Line Flags (override config and env vars):
  • --region - Platform region (us or eu). Selects https://api-us.cybedefend.com or https://api-eu.cybedefend.com
  • --api-url - API base URL (manual override; takes precedence over --region)
  • --project-id - Project ID
Deprecated: The --api-key flag and CYBEDEFEND_API_KEY environment variable have been removed. Use CYBEDEFEND_PAT with a Personal Access Token instead.

Commands

1. scan

Starts a new scan by uploading a directory or a pre-zipped file to the CybeDefend platform. By default, the command waits for the scan to complete and displays a summary of findings. Flags:
  • --dir, -d - Directory to scan (will be zipped before uploading). Cannot be used with --file
  • --file, -f - Pre-zipped file to scan. Cannot be used with --dir
  • --project-id - Project ID for the scan (required if not set in config/env)
  • --region - Platform region: us (default) or eu
  • --api-url - Manual API URL override (takes precedence over --region)
  • --wait, -w - Wait for scan completion before exiting (default: true)
  • --interval - Polling interval in seconds when waiting (default: 5)
  • --break-on-fail - Exit with error code if scan fails (default: false)
  • --break-on-severity - Exit with error code if vulnerabilities of specified severity or higher are found. Values: critical, high, medium, low
  • --ci - CI/CD-friendly output (no colors, ASCII art, or extra formatting)

Examples

2. results

Retrieves scan results for a specific project. By default, fetches SAST results in JSON format and saves to results.json in the current directory. Flags:
  • --project-id - Project ID to fetch results (required if not set in config/env)
  • --type, -t - Type of results: sast (default) or iac
  • --page, -p - Page number to fetch (default: 1). Ignored if --all is set
  • --all, -a - Fetch all results across all pages
  • --output, -o - Output format: json (default), html, or sarif
  • --filename, -f - Output file name (default: results.json)
  • --filepath - Path to save file (default: .)
  • --ci - CI/CD-friendly output

Examples

3. version

Displays the CLI version:

4. completion

Generates shell autocompletion for bash, zsh, etc.:

CI/CD Integration

Combine the scan and results commands in your pipelines. The scan command’s --wait, --break-on-fail, and --break-on-severity flags are particularly useful for controlling pipeline flow based on scan outcomes. For example, in GitHub Actions:
Use --ci for minimal logs during the scan. The --break-on-* flags allow automatic build failure based on your security policies. You can still use cybedefend results to fetch detailed reports if the scan passes the break conditions or if you need the data regardless.
Related: Code Repository Scanning · CI/CD Integrations · GitHub CLI Repository