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

Was this helpful?

  1. SAFETY CLI
  2. Scanning for Vulnerable and Malicious Packages

Scanning in Production

To run Safety in the production environment, you need to set the stage to production. This ensures that the security scans are aligned with the strict requirements of production environments.

Option 1: Run Safety in Production

To run the Safety CLI in production, use the --stage flag set to production like this: safety --stage production scan

Ensure the $SAFETY_API_KEY is set as an environment variable before running the command.

Option 2: Run as a Cron Job

If you want to automate this process, you can set up a cron job to periodically run Safety CLI within your Python repository. Here's an example cron job configuration:

# Run Safety every day at midnight
0 0 * * * cd /path/to/repo && \
safety --stage production scan >> \
/var/log/safety.log 2>&1

This will scan your production environment every day at midnight, appending the output to /var/log/safety.log.

PreviousExit CodesNextSafety Telemetry

Last updated 7 months ago

Was this helpful?