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

graph-evolution

Ce qu’il fait

Ce skill compare la structure du code à deux moments de l'historique d'un projet, comme deux commits ou deux étiquettes de version. Il met en évidence les changements qui pourraient affecter la sécurité, comme de nouveaux chemins vers du code sensible. Il s'adresse aux relecteurs de sécurité et aux contrôles de version.

Quand l’utiliser

  • ✓Quand vous voulez savoir ce qui a changé structurellement entre deux commits ou étiquettes git.
  • ✓Quand vous soupçonnez qu'une modification a discrètement élargi la surface d'attaque ou la portée d'une fonction.
  • ✓Quand vous préparez une publication et voulez une comparaison axée sur la sécurité avec la version précédente.

Lien du skill

https://github.com/trailofbits/skills/blob/main/plugins/trailmark/skills/graph-evolution/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/trailmark/skills/graph-evolution/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

“Compare la structure du code entre la v1.2 et la v1.3 et dis-moi si de nouveaux chemins d'attaque sont apparus.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

Il construit un graphe du code pour chaque version, puis les compare pour trouver de nouveaux chemins d'entrée, les changements de complexité et les modifications du flux des données et des permissions.

Contenu technique (SKILL.md original)

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

Graph Evolution

Builds Trailmark code graphs at two source snapshots and computes a structural diff. Surfaces security-relevant changes that text-level diffs miss: new attack paths, complexity shifts, blast radius growth, taint propagation changes, and privilege boundary modifications.

When to Use

  • Comparing two git refs to understand what structurally changed
  • Auditing a range of commits for security-relevant evolution
  • Detecting new attack paths created by code changes
  • Finding functions whose blast radius or complexity grew silently
  • Identifying taint propagation changes across refactors
  • Pre-release structural comparison (tag-to-tag or branch-to-branch)

When NOT to Use

  • Line-level code review (use differential-review for text-diff analysis)
  • Single-snapshot analysis (use the trailmark skill directly)
  • Diagram generation from a single snapshot (use the diagramming-code skill)
  • Mutation testing triage (use the genotoxic skill)

Rationalizations to Reject

Rationalization Why It's Wrong Required Action
"We just need the structural diff, skip pre-analysis" Without pre-analysis, you miss taint changes, blast radius growth, and privilege boundary shifts Run engine.preanalysis() on both snapshots
"Text diff covers what changed" Text diffs miss new attack paths, transitive complexity shifts, and subgraph membership changes Use structural diff to complement text diff
"Only added nodes matter" Removed security functions and shifted privilege boundaries are equally dangerous Review removals and modifications, not just additions
"Low-severity structural changes can be ignored" INFO-level changes (dead code removal) can mask removed security checks Classify every change, review removals for replaced functionality
"One snapshot's graph is enough for comparison" Single-snapshot analysis can't detect evolution — you need both before and after Always build and export both graphs
"Tool isn't installed, I'll compare manually" Manual comparison misses what graph analysis catches Install trailmark first
"The diff came back empty, so nothing changed structurally" trailmark diff defaults --language to python and exits 0 with empty arrays on any other target, so an empty diff reads identically whether the code is unchanged or the language was wrong Pass --language explicitly and re-run before concluding no change

Prerequisites

trailmark must be installed. If uv run trailmark fails, run:

uv tool install trailmark
# Python snippets: uv run --with trailmark python -   (a tool env is not importable)

DO NOT fall back to "manual comparison" or reading source files as a substitute for running trailmark. The tool must be installed and used programmatically. If installation fails, report the error.


Quick Start

# Compare two git refs (e.g., tags, branches, commits)
# 1. Build graphs at each snapshot
# 2. Run pre-analysis on both
# 3. Compute structural diff
# 4. Generate report

# Step-by-step: see Workflow below

Decision Tree

├─ Need to understand what each metric means?
│  └─ Read: references/evolution-metrics.md
│
├─ Need the report output format?
│  └─ Read: references/report-format.md
│
├─ Already have two graph JSON exports?
│  └─ Jump to Phase 3 (run native diff + graph_diff.py)
│
└─ Starting from two git refs?
   └─ Start at Phase 1

Workflow

Graph Evolution Progress:
- [ ] Phase 1: Create snapshots (git worktrees)
- [ ] Phase 2: Build graphs + pre-analysis on both snapshots
- [ ] Phase 3: Compute structural diff
- [ ] Phase 4: Interpret diff and generate report
- [ ] Phase 5: Clean up worktrees

Phase 1: Create Snapshots

Use git worktrees to get clean copies of each ref without disturbing the working tree.

# Create temp directories for worktrees
BEFORE_DIR=$(mktemp -d)
AFTER_DIR=$(mktemp -d)

# Create worktrees (run from repo root)
git worktree add "$BEFORE_DIR" {before_ref}
git worktree add "$AFTER_DIR" {after_ref}

If comparing two directories instead of git refs, skip this phase and use the directory paths directly in Phase 2.

Phase 2: Build Graphs and Run Pre-Analysis

Build Trailmark graphs for both snapshots and run pre-analysis on each. Pre-analysis computes blast radius, taint propagation, privilege boundaries, and entrypoint enumeration.

from tra
Questions fréquentes

Peut-il comparer des dossiers et pas seulement des références git ?

Le skill indique qu'il fonctionne avec des commits git, des étiquettes ou des dossiers.

Remplace-t-il la lecture du diff du code ?

Non. Il ajoute une vue structurelle, et une relecture ligne par ligne reste nécessaire.

Vérifie-t-il la qualité générale du code ?

Non. Il se concentre sur les changements pertinents pour la sécurité, comme les chemins d'attaque et les frontières de privilèges.

Détails

Description originale de l’auteur

Compares Trailmark code graphs at two source code snapshots (git commits, tags, or directories) to surface security-relevant structural changes. Detects new attack paths, complexity shifts, blast radius growth, taint propagation changes, and privilege boundary modifications that text diffs miss. Use when comparing code between commits or tags, analyzing structural evolution, detecting attack surface growth, reviewing what changed between audit snapshots, or finding security-relevant changes that text diffs miss.

repo: trailofbits/skills

Popularité

Étoiles GitHub
8.0k
Position au classement
#12729
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