Aller au contenu
Skillpedia
Sécurité8.0k · #12739

variant-analysis

Ce qu’il fait

Ce skill prend un bug que vous avez déjà trouvé et cherche d'autres occurrences de la même cause première dans une base de code. Il s'adresse aux auditeurs de sécurité et aux développeurs qui viennent de trouver un problème.

Quand l’utiliser

  • ✓Quand un bug est trouvé dans un fichier et que vous voulez savoir où il se produit ailleurs.
  • ✓Quand on vous demande si un nouveau problème est le même bug qu'un bug antérieur.
  • ✓Quand vous voulez transformer un bug connu en règle de recherche CodeQL ou Semgrep.

Lien du skill

https://github.com/trailofbits/skills/blob/main/plugins/variant-analysis/skills/variant-analysis/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/trailofbits/skills/blob/main/plugins/variant-analysis/skills/variant-analysis/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Nous venons de trouver une vérification de permission manquante dans ce fichier. Y a-t-il d'autres endroits du code où la même erreur se produit ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

Il procède en cinq étapes : il trouve la cause première, écrit un motif qui ne correspond qu'au bug connu, généralise ce motif, puis cherche les correspondances dans le code.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

Variant Analysis

Find the other instances of a bug you have already found. One root cause usually has several manifestations, and they are rarely in the module where you found the first one.

When to Use

  • A vulnerability has been found and you need to search for similar instances
  • Building or refining CodeQL/Semgrep queries for security patterns
  • Performing systematic code audits after an initial issue discovery
  • Analyzing how a single root cause manifests in different code paths

When NOT to Use

  • Initial vulnerability discovery — use audit-context-building or a domain-specific audit
  • General code review with no known pattern to search for
  • Writing fix recommendations — use issue-writer
  • Understanding unfamiliar code — use audit-context-building first

The Five Steps

Read the reference for a step when you reach it.

1. Understand the original issue. Extract the root cause — why the code is wrong, not what it does — and enumerate the directions a variant could hide in: related identifiers, other manifestations of the same mistake, data-type edge cases. → references/root-cause.md

2. Create an exact match. Write a pattern matching ONLY the known instance and confirm it hits. A pattern that matches nothing means you have misunderstood the bug, and every search built on it is calibrated against the wrong code.

3–4. Generalize one element at a time. Climb from the exact match toward the pattern family, running and reading all matches after each single change. Stop when more than half the matches are noise. → references/searching.md — abstraction ladder, tool selection, false-positive filters

5. Triage. Decide which candidates are real, and say so with a severity attached. → references/triage.md

Then write it up, including the patterns that failed and a CI rule to prevent regression. → references/reporting.md

Running it as a Workflow

This plugin ships /variant-analysis:variants, which runs the five steps across parallel subagents — one per expansion axis, looping until the sweep stops finding anything new. Each stage reads the reference above that matches its job.

Use the workflow when the codebase is large or the root cause has many manifestations. Work the steps directly when the search is narrow or you want a say in each generalization.

What Makes Hunts Fail

  1. Narrow scope — searching only the module the original bug was in
  2. Pattern too specific — searching one attribute and missing the family around it
  3. One vulnerability class — chasing a single manifestation of the root cause
  4. Happy-path testing — never trying the null, empty, and boundary cases
  5. Generalizing too fast — abstracting several elements at once, so noise cannot be attributed to any one of them

The first three are covered in root-cause.md and searching.md, the fourth in triage.md.

Resources

CodeQL (resources/codeql/): python.ql, javascript.ql, java.ql, go.ql, cpp.ql

Semgrep (resources/semgrep/): python.yaml, javascript.yaml, java.yaml, go.yaml, cpp.yaml

Report: resources/variant-report-template.md

Questions fréquentes

Sert-il à trouver de nouveaux bugs depuis zéro ?

Non. Il sert à trouver d'autres occurrences d'un bug que vous connaissez déjà.

Écrit-il la correction ?

Non. Le skill se concentre sur la recherche des variantes et ne rédige pas de recommandations de correction.

Peut-il aider à écrire des règles de recherche ?

Oui. Il peut aider à créer des requêtes CodeQL ou Semgrep à partir d'un cas connu.

Détails

Description originale de l’auteur

Hunts for the other instances of a bug already found — the variants of one root cause across a codebase. Use immediately after a vulnerability, logic bug, or bad pattern turns up in a specific file and the question becomes where else it occurs, including the bare conversational form ("are there others like this?", "is this the same bug?"). Also for generalizing one known instance into a CodeQL or Semgrep query for its whole pattern family, and for triaging a set of look-alike candidates against a known root cause. Not for initial discovery with no bug in hand.

repo: trailofbits/skills

Popularité

Étoiles GitHub
8.0k
Position au classement
#12739
Licence
CC-BY-SA-4.0
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires