Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问clear审计提醒

semgrepsemgrep 搜索

Agent Skill

semgrep 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

75,144

周安装

3,099

GitHub Stars

4,917

下载量

24,552
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:semgrep(semgrep 搜索)
来源仓库:https://github.com/trailofbits/skills
仓库路径:skills/semgrep
安装命令:
npx skills add https://github.com/trailofbits/skills --skill semgrep
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/trailofbits/skills --skill semgrep

简介

并行静态分析扫描器,具有自动语言检测、Pro 跨文件污点跟踪和合并 SARIF 输出。

  • 支持两种扫描模式:“全部运行”(完整的规则集覆盖)和“仅重要”(按严重性和影响过滤的高可信度安全漏洞)
  • 自动检测 Semgrep Pro 的可用性以进行跨文件污点分析;通过按文件扫描回退到 OSS 模式
  • 包括来自 Trail of Bits、0xdea 和 Decurity 的第三方规则集以及官方规则,以捕获默认注册表中缺少的漏洞
  • 为多语言代码库生成并行扫描器子代理;将所有结果合并到单个 SARIF 文件中,并包含严重性和类别细分
  • 在执行开始之前需要用户明确批准扫描计划(语言、规则集、模式、目标目录)

SKILL.md

Semgrep Security Scan

Run a Semgrep scan with automatic language detection, parallel execution via Task subagents, and merged SARIF output.

Essential Principles

  1. Always use --metrics=off — Semgrep sends telemetry by default; --config auto also phones home. Every semgrep command must include --metrics=off to prevent data leakage during security audits.
  2. User must approve the scan plan (Step 3 is a hard gate) — The original "scan this codebase" request is NOT approval. Present exact rulesets, target, engine, and mode; wait for explicit "yes"/"proceed" before spawning scanners.
  3. Third-party rulesets are required, not optional — Trail of Bits, 0xdea, and Decurity rules catch vulnerabilities absent from the official registry. Include them whenever the detected language matches.
  4. Spawn all scan Tasks in a single message — Parallel execution is the core performance advantage. Never spawn Tasks sequentially; always emit all Task tool calls in one response.
  5. Always check for Semgrep Pro before scanning — Pro enables cross-file taint tracking and catches ~250% more true positives. Skipping the check means silently missing critical inter-file vulnerabilities.

When to Use

  • Security audit of a codebase
  • Finding vulnerabilities before code review
  • Scanning for known bug patterns
  • First-pass static analysis

When NOT to Use

  • Binary analysis → Use binary analysis tools
  • Already have Semgrep CI configured → Use existing pipeline
  • Need cross-file analysis but no Pro license → Consider CodeQL as alternative
  • Creating custom Semgrep rules → Use semgrep-rule-creator skill
  • Porting existing rules to other languages → Use semgrep-rule-variant-creator skill

Output Directory

All scan results, SARIF files, and temporary data are stored in a single output directory.

  • If the user specifies an output directory in their prompt, use it as OUTPUT_DIR.
  • If not specified, default to ./static_analysis_semgrep_1. If that already exists, increment to _2, _3, etc.

In both cases, always create the directory with mkdir -p before writing any files.

# Resolve output directory
if [ -n "$USER_SPECIFIED_DIR" ]; then
  OUTPUT_DIR="$USER_SPECIFIED_DIR"
else
  BASE="static_analysis_semgrep"
  N=1
  while [ -e "${BASE}_${N}" ]; do
    N=$((N + 1))
  done
  OUTPUT_DIR="${BASE}_${N}"
fi
mkdir -p "$OUTPUT_DIR/raw" "$OUTPUT_DIR/results"

The output directory is resolved once at the start of Step 1 and used throughout all subsequent steps.

$OUTPUT_DIR/
├── rulesets.txt                 # Approved rulesets (logged after Step 3)
├── raw/                         # Per-scan raw output (unfiltered)
│   ├── python-python.json
│   ├── python-python.sarif
│   ├── python-django.json
│   ├── python-django.sarif
│   └── ...
└── results/                     # Final merged output
    └── results.sarif

Prerequisites

Required: Semgrep CLI (semgrep --version). If not installed, see Semgrep installation docs.

Optional: Semgrep Pro — enables cross-file taint tracking, inter-procedural analysis, and additional languages (Apex, C#, Elixir). Check with:

semgrep --pro --validate --config p/default 2>/dev/null && echo "Pro available" || echo "OSS only"

Limitations: OSS mode cannot track data flow across files. Pro mode uses -j 1 for cross-file analysis (slower per ruleset, but parallel rulesets compensate).

Scan Modes

Select mode in Step 2 of the workflow. Mode affects both scanner flags and post-processing.

ModeCoverageFindings Reported
Run allAll rulesets, all severity levelsEverything
Important onlyAll rulesets, pre- and post-filteredSecurity vulns only, medium-high confidence/impact

Important only applies two filter layers:

  1. Pre-filter: --severity MEDIUM --severity HIGH --severity CRITICAL (CLI flag)
  2. Post-filter: JSON metadata — keeps only category=security, confidence∈{MEDIUM,HIGH}, impact∈{MEDIUM,HIGH}

See scan-modes.md for metadata criteria and jq filter commands.

Orchestration Architecture

┌──────────────────────────────────────────────────────────────────┐
│ MAIN AGENT (this skill)                                          │
│ Step 1: Detect languages + check Pro availability                │
│ Step 2: Select scan mode + rulesets (ref: rulesets.md)           │
│ Step 3: Present plan + rulesets, get approval [⛔ HARD GATE]     │
│ Step 4: Spawn parallel scan Tasks (approved rulesets + mode)     │
│ Step 5: Merge results and report                                 │
└──────────────────────────────────────────────────────────────────┘
         │ Step 4
         ▼
┌─────────────────┐
│ Scan Tasks      │
│ (parallel)      │
├─────────────────┤
│ Python scanner  │
│ JS/TS scanner   │
│ Go scanner      │
│ Docker scanner  │
└─────────────────┘

Workflow

Follow the detailed workflow in scan-workflow.md. Summary:

StepActionGateKey Reference
1Resolve output dir, detect languages + Pro availabilityUse Glob, not Bash
2Select scan mode + rulesetsrulesets.md
3Present plan, get explicit approval⛔ HARDAskUserQuestion
4Spawn parallel scan Tasksscanner-task-prompt.md
5Merge results and reportMerge script (below)

Task enforcement: On invocation, create 5 tasks with blockedBy dependencies (each step blocks the previous). Step 3 is a HARD GATE — mark complete ONLY after user explicitly approves.

Merge command (Step 5):

uv run {baseDir}/scripts/merge_sarif.py $OUTPUT_DIR/raw $OUTPUT_DIR/results/results.sarif

Agents

AgentToolsPurpose
static-analysis:semgrep-scannerBashExecutes parallel semgrep scans for a language category

Use subagent_type: static-analysis:semgrep-scanner in Step 4 when spawning Task subagents.

Rationalizations to Reject

ShortcutWhy It's Wrong
"User asked for scan, that's approval"Original request ≠ plan approval. Present plan, use AskUserQuestion, await explicit "yes"
"Step 3 task is blocking, just mark complete"Lying about task status defeats enforcement. Only mark complete after real approval
"I already know what they want"Assumptions cause scanning wrong directories/rulesets. Present plan for verification
"Just use default rulesets"User must see and approve exact rulesets before scan
"Add extra rulesets without asking"Modifying approved list without consent breaks trust
"Third-party rulesets are optional"Trail of Bits, 0xdea, Decurity catch vulnerabilities not in official registry — REQUIRED
"Use --config auto"Sends metrics; less control over rulesets
"One Task at a time"Defeats parallelism; spawn all Tasks together
"Pro is too slow, skip --pro"Cross-file analysis catches 250% more true positives; worth the time
"Semgrep handles GitHub URLs natively"URL handling fails on repos with non-standard YAML; always clone first
"Cleanup is optional"Cloned repos pollute the user's workspace and accumulate across runs
"Use . or relative path as target"Subagents need absolute paths to avoid ambiguity
"Let the user pick an output dir later"Output directory must be resolved at Step 1, before any files are created

Reference Index

FileContent
rulesets.mdComplete ruleset catalog and selection algorithm
scan-modes.mdPre/post-filter criteria and jq commands
scanner-task-prompt.mdTemplate for spawning scanner subagents
WorkflowPurpose
scan-workflow.mdComplete 5-step scan execution process

Success Criteria

  • Output directory resolved (user-specified or auto-incremented default)
  • All generated files stored inside $OUTPUT_DIR
  • Languages detected with file counts; Pro status checked
  • Scan mode selected by user (run all / important only)
  • Rulesets include third-party rules for all detected languages
  • User explicitly approved the scan plan (Step 3 gate passed)
  • All scan Tasks spawned in a single message and completed
  • Every semgrep command used --metrics=off
  • Approved rulesets logged to $OUTPUT_DIR/rulesets.txt
  • Raw per-scan outputs stored in $OUTPUT_DIR/raw/
  • results.sarif exists in $OUTPUT_DIR/results/ and is valid JSON
  • Important-only mode: post-filter applied before merge; unfiltered results preserved in raw/
  • Results summary reported with severity and category breakdown
  • Cloned repos (if any) cleaned up from $OUTPUT_DIR/repos/

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

26.44%
按下载量换算6,492

Codex

26.09%
按下载量换算6,406

OpenCode

17.94%
按下载量换算4,405

Gemini CLI

13.28%
按下载量换算3,261

Antigravity

7.91%
按下载量换算1,942

Cursor

3.79%
按下载量换算931

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/trailofbits/skills --skill semgrep;npx skills add trailofbits/skills --skill "semgrep" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills