Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Safety

$ safety Official Low Risk
Safety Cybersecurity · Security & Secrets · MIT · macos / linux / windows

Safety (safety) audits Python virtual environments, requirements.txt, pyproject.toml, and lockfiles against PyUp's vulnerability database. Modern v3 safety scan provides --output json and --filter top-level selection, though non-interactive runs require SAFETY_API_KEY or prior safety auth.

FCRS-1.0 Score
79 /100
Good
Medium Confidence
Zero-Friction Install
pip install safety
CLI vs MCP Decision CLI Preferred vs MCP

Scanning local Python environments and requirements.txt via safety scan --output json runs directly in the target virtualenv without MCP bridging.

Agent-Readiness Checklist

✓ JSON Output
✓ Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 20 / 25

Provides --output json, --detailed-output, and --filter key selection, though unauthenticated safety scan prompts for login.

  • Native --output json and --filter top-level JSON filtering
  • Requires SAFETY_API_KEY or safety auth to avoid interactive auth prompts
Trust & Safety 20 / 25

Read-only package metadata inspection by default, though safety scan transmits package names/versions to Safety's API and supports telemetry unless disabled.

  • Sends local dependency metadata to Safety cloud API during scan
  • Supports --disable-optional-telemetry
Setup & Portability 13 / 15

Easy installation via pip install safety or uvx safety across macOS, Linux, and Windows.

  • Standard PyPI package with uvx support
Utility & Efficiency 11 / 15

Well-tailored to Python environments and requirements files, though commercial DB gating and auth friction reduce edge over pip-audit.

  • Detects Python vulnerabilities and remediation versions
Maintenance & Lineage 8 / 10

Maintained by Safety Cybersecurity (PyUp) with active v3 CLI releases.

  • Official vendor repo at pyupio/safety
Docs & Verifiability 7 / 10

Official documentation at docs.safetycli.com covers v3 scan and legacy check migration.

  • Vendor CLI docs at docs.safetycli.com

Security, Auth & Guardrails

Auth Modes
Env API Key OAuth Browser Config File
Credential Storage

Stores OAuth/API credentials in ~/.safety/ via safety auth, or reads SAFETY_API_KEY from the environment for CI/headless use.

Side Effects
Read-Only Local Write
Cost & Quotas

CLI is MIT open-source; Safety v3 account/API key required, with free tier limits and paid commercial vulnerability DB plans.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Safety Agent Rules
- Set `SAFETY_API_KEY` (or run `safety auth` beforehand) so `safety scan` does not block waiting for interactive login.
- Prefer `--output json --filter cve_details` or `--save-as json out.json` to keep output bounded.
- Never run `safety fix` or package upgrades without explicit user approval.

Agent-Ready Command Recipes

Safe Read-Only Queries

Scan current Python project and output JSON
safety scan --output json

Audits installed packages and dependency files in the workspace and prints a structured JSON report.

Extract only CVE details with JSON filter
safety scan --detailed-output --output json --filter cve_details

Uses --filter cve_details to isolate CVE metadata and avoid dumping the full scanned_packages payload.

Strengths for Agents

  • + Clean --output json with --filter (meta, scan_results, cve_details) reduces context noise.
  • + Supports scanning both active virtualenvs and static requirements.txt / Poetry / Pipenv lockfiles.

Caveats & Pitfalls

  • ! Safety v3 requires registration/API key (SAFETY_API_KEY) for headless runs, unlike zero-auth pip-audit.
  • ! Sends package inventory to Safety's API unless using paid offline database bundles.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI