Safety v3.5.1 is now available. Upgrade using "pip install -U safety"
Safety Firewall
LogoLogo
Safety PlatformResearchSign Up
  • Introduction to Safety
  • Safety Firewall
    • Introduction to Safety Firewall
    • Installation and Configuration
      • Uninstalling Firewall
    • Using Firewall
      • Working with Codebases
      • Firewall Monitoring and Management
      • Firewall Policy Management
      • Troubleshooting
  • SAFETY CLI
    • Introduction to Safety CLI Vulnerability Scanning
      • Quick Start Guide
      • Migrating from Safety CLI 2.x to Safety CLI 3.x
    • Installation and Authentication
    • Scanning for Vulnerable and Malicious Packages
      • Viewing Scan Results
      • Available Commands and Inputs
      • Scanning in CI/CD
      • Securing Development Environments
      • License Scanning
      • Exit Codes
      • Scanning in Production
    • Safety Telemetry
  • Vulnerability Remediation
    • Applying Fixes
  • Integration
    • Securing Git Repositories
      • GitHub
        • GitHub Actions
      • GitLab
      • BitBucket
      • Azure DevOps
      • Git Post-Commit Hooks
    • Pipenv
    • Docker Containers
  • Administration
    • Safety Policy Files
    • Project Policies
  • Output
    • Output Options and Recommendations
    • JSON Output
    • SBOM Output
    • HTML Output
    • Detecting Vulnerabilities and Sharing Results via Email
  • Support
    • Support
    • Invalid API Key Error
    • Headless Authentication
    • Implementation Support
    • Global proxy and identity configuration
    • Using Safety in Conda Environments
  • Miscellaneous
    • Understanding Vulnerability Scoring Systems: CVSS and EPSS
    • Release Notes
      • Breaking Changes in Safety 3
    • Research and Blog
    • Changelogs
    • Trust Center
    • Terms of Service
    • Safety 2.x Documentation
Powered by GitBook
LogoLogo

Safety Platform

  • Sign Up
  • Login

Research

  • Security Research & Blog

Resources

  • GitHub Action
  • GitHub

© Safety CLI Cybersecurity Inc.

On this page
  • Command Line Interface
  • 1. Installation
  • 2. Log In or Register
  • 3. Running Your First Scan
  • Basic Commands
  • GitHub Action

Was this helpful?

  1. SAFETY CLI
  2. Introduction to Safety CLI Vulnerability Scanning

Quick Start Guide

PreviousIntroduction to Safety CLI Vulnerability ScanningNextMigrating from Safety CLI 2.x to Safety CLI 3.x

Last updated 22 days ago

Was this helpful?

Running your first scan using Safety CLI takes less than a minute and can be performed via our or through the . Below we detail , , and .

To learn more about upgrading from Safety 2.x to Safety CLI please check out our .

Command Line Interface

1. Installation

Begin by installing Safety on your development machine.

  1. Open your Terminal

  2. Run the following command to install:

pip install safety

If you already have Safety installed, please use pip install -U safety

2. Log In or Register

1. Once installed, try to run your first scan using the following command:

safety scan

2. If you are already logged in, Safety will perform the scan. If you are not already authenticated, Safety CLI will prompt you to or using existing credentials.

In both cases, a browser window will open with clear instructions on how to log in or create a new account. Once logged in, Safety CLI will show that you are authenticated and can proceed with the next step.

To check your authentication status, you can run safety auth at any time.

3. Running Your First Scan

  1. Using the Terminal, navigate to a project, e.g. cd my/project/. (This root folder would normally contain files such as composer.lock, requirements.txt, READMEs, Pipfile.lock, pyproject.toml, .gitignores etc.)

  2. Run the safety scan command.

  3. Safety will now perform a scan of the current project directory, detecting all Python installations and requirements files. The output of the scan will be presented in the Terminal window.

Performing scans across entire development machines and in CI/CD

Detailed documentation on how to integrate Safety with other tools, perform system-wide scans, and more are available via the links to the left.

Jupyter Notebook Quickstart

For users who prefer a more interactive environment, we also provide a Jupyter Notebook Quickstart guide. This notebook offers step-by-step instructions for running Safety CLI within a Jupyter environment, making it easier to explore the functionality and perform your first scan in a familiar interface.

Basic Commands

  • safety --help accesses Help and displays all available commands, utility commands, and options.

  • safety auth starts the authentication flow if not logged in and displays authentication status if logged in.

  • safety scan performs a vulnerability scan in the current directory.

  • safety system-scan performs a vulnerability scan across the entire development machine.

  • safety scan --apply-fixes performs a scan and automatically updates vulnerable dependencies to the next secure version.

Enterprise Customers:

  • Your organization may require installation to be performed via approved software bundles.

  • If your organization leverages SAML-based authentication, you will be prompted to enter your corporate login credentials at the authentication stage.

GitHub Action

GitHub Actions

You will be unable to perform vulnerability scans unless you are authenticated. If you require assistance, please email .

You can access the quickstart notebook here: .

The following are the most commonly used commands. .

If you are unsure whether your organization uses either of these options, please contact your administrator or email .

The quickest way to test Safety CLI in CI/CD is by using our , new in Safety CLI. Full is available here:

If you require assistance, please email .

Create an account and access your free trial here.
support@safetycli.com
Jupyter Notebook Quickstart
A full glossary of available commands can be found here
support@safetycli.com
GitHub Action
documentation on the GitHub Action
support@safetycli.com
Migration guide
create an account
log in
Command Line Interface
GitHub Action
1. Installation
2. Authentication
3. Running your first scan
Safety CLI after Successful Authentication
Page cover image