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

Semgrep

$ semgrep Official Low Risk
Semgrep Inc. · Security & Secrets · LGPL-2.1 · macos / linux

semgrep runs syntax-aware static security and bug-pattern rules across 30+ languages. Agents can invoke semgrep scan --json --metrics=off --quiet with local YAML rules or OSS registry packs and preview autofixes safely with --dryrun.

FCRS-1.0 Score
90 /100
Excellent
Medium Confidence
Zero-Friction Install
brew install semgrep
CLI vs MCP Decision CLI Preferred vs MCP

Running semgrep scan --json locally inside the repo delivers full SAST findings directly with no MCP wrapper required.

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 23 / 25

Supports --json, --sarif, --quiet, --metrics=off, --dryrun, and --error exit codes.

  • Native --json, --dryrun, and --metrics=off flags
Trust & Safety 21 / 25

Read-only by default unless --autofix (without --dryrun) is passed; --metrics=off disables usage telemetry.

  • Telemetry opt-out via --metrics=off; read-only default scan
Setup & Portability 13 / 15

Easy via brew or pip install semgrep on macOS and Linux (Windows requires WSL2).

  • macOS and Linux native support; no native Windows binary
Utility & Efficiency 15 / 15

Bridges custom grep patterns and full SAST taint analysis with readable YAML rules.

  • 30+ languages with YAML rule authoring and --autofix
Maintenance & Lineage 9 / 10

Backed by Semgrep Inc. (semgrep/semgrep) with strong OSS and AppSec adoption.

  • Active vendor-backed repository
Docs & Verifiability 9 / 10

Thorough docs at semgrep.dev/docs/ covering CLI flags, rule syntax, and JSON schema.

  • Comprehensive official documentation

Security, Auth & Guardrails

Auth Modes
No Auth Env API Key OAuth Browser
Credential Storage

Optional SEMGREP_APP_TOKEN or ~/.semgrep/settings.yml for Semgrep Cloud; OSS local/registry rules run without login.

Side Effects
Read-Only Local Write
Cost & Quotas

OSS CLI engine is free (LGPL-2.1); Semgrep Pro cross-file rules require a commercial license.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Semgrep Agent Rules
- Always pass `--json --metrics=off --quiet` for structured findings without telemetry or spinner noise.
- Preview `--autofix` with `--dryrun` first; use local rule files (`--config ./rules.yaml`) in air-gapped environments.

Agent-Ready Command Recipes

Safe Read-Only Queries

Run local/OSS security rules with JSON output and telemetry off
semgrep scan --config p/default --json --metrics=off --quiet .

Scans the repository for common security vulnerabilities and emits structured JSON.

Preview rule-based autofixes without modifying files
semgrep scan --config ./rules.yaml --autofix --dryrun --json .

Shows proposed fix replacements in JSON without writing to source files.

Controlled Writes & Previews

Apply deterministic rule autofixes to working tree
semgrep scan --config ./rules.yaml --autofix --metrics=off .

Writes automated rule fixes in-place after dry-run verification.

Strengths for Agents

  • + Rich --json SAST output across 30+ languages with --metrics=off telemetry control.
  • + Supports safe --autofix --dryrun previews before mutating files.

Caveats & Pitfalls

  • ! --config auto or p/... packs fetch rules over HTTPS and send anonymized metrics unless --metrics=off and local YAML configs are used.
  • ! Native Windows is not supported without WSL.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI