agentleFS
mguttmannmguttmann/code-audit-suite/skills/opengrep-sast/SKILL.md

opengrep-sast

Skill0 starsChanged 5 months agoMITView on GitHub

This skill should be used when the user asks to "run Opengrep", "deep SAST", "tiefes SAST", "custom security rules", "eigene Sicherheitsregeln", "taint analysis", "Taint-Analyse", "scan for injection/dataflow vulnerabilities", or wants source-to-sink security analysis beyond SonarQube's fixed ruleset. Runs Opengrep (a free Semgrep fork) in Docker and drives findings to zero, processed directly in Claude Code.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Write organization-specific rules as YAML and point Opengrep at them with OPENGREP_RULES_DIR (it takes precedence over OPENGREP_CONFIG and …

    line 37
  2. Very specific:

    Use a focused registry pack instead of auto with OPENGREP_CONFIG=p/owasp-top-ten (or other packs).

    line 58

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Opengrep SAST

Purpose

Opengrep is a fully free, self-hostable deep SAST engine (a community fork of Semgrep). It complements SonarQube where Sonar is weakest: custom, organization-specific source→sink taint rules expressed as YAML. SonarQube runs a fixed, vendor-controlled ruleset; Opengrep lets the team encode their own anti-patterns (e.g. "a tainted request parameter must never reach our internal exec() wrapper", "forbidden internal API X is called").

It is the chosen free SAST complement. No separate Semgrep CE skill exists — Opengrep is the superset (it restores intra-file cross-function taint that Semgrep's free tier removed). If the organization already pays for GitHub Advanced Security, CodeQL offers deeper global cross-file analysis as an additional layer; otherwise Opengrep is the free self-hosted choice.

Core Workflow (drive to zero)

  1. Scan with the registry's auto ruleset:
    ~/.claude/skills/opengrep-sast/scripts/scan.sh [TARGET_DIR]
  2. Fix each finding at the root cause (sanitize/validate input, use safe APIs, remove the dangerous sink). Do not silence with # nosemgrep unless a finding is a verified false positive — and justify it inline.
  3. Re-run until the scan exits 0.

Custom rules (the main value)

Write organization-specific rules as YAML and point Opengrep at them with OPENGREP_RULES_DIR (it takes precedence over OPENGREP_CONFIG and is mounted read-only into the container):

OPENGREP_RULES_DIR=/path/to/my-rules \
  ~/.claude/skills/opengrep-sast/scripts/scan.sh [TARGET_DIR]

A minimal taint rule:

rules:
  - id: tainted-input-to-internal-exec
    mode: taint
    pattern-sources: [{ pattern: "request.$ANY" }]
    pattern-sinks: [{ pattern: "internal.exec(...)" }]
    message: Untrusted input reaches internal exec wrapper.
    languages: [python]
    severity: ERROR

Use a focused registry pack instead of auto with OPENGREP_CONFIG=p/owasp-top-ten (or other packs).

Notes

  • --error makes the scan exit non-zero when any finding is reported, which drives the loop.
  • The default OPENGREP_CONFIG=auto resolves rules from the registry and so requires network. For an offline/air-gapped run, mount your own rules via OPENGREP_RULES_DIR (there is no bundled offline ruleset in the image).
  • JSON output for programmatic parsing: OPENGREP_JSON=1 scan.sh [DIR].

Resources

  • scripts/scan.sh — runs opengrep scan against a directory with the configured ruleset. Exit: 0 = no findings, 1 = FINDINGS, 125 = operational error (rule-registry/network/image failure — NOT a finding). Env: OPENGREP_CONFIG, OPENGREP_RULES_DIR, OPENGREP_JSON.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.