Skip to content
Skillpedia
Security8.0k Β· #12729

graph-evolution

What it does

This skill compares the code structure at two points in a project's history, such as two commits or release tags. It highlights changes that could affect security, such as new paths into sensitive code. It is for security reviewers and release checks.

When to use it

  • βœ“When you want to know what changed structurally between two git commits or release tags.
  • βœ“When you suspect a change quietly widened the attack surface or the reach of a function.
  • βœ“When you are preparing a release and want a security-focused comparison with the previous version.

Skill link

https://github.com/trailofbits/skills/blob/main/plugins/trailmark/skills/graph-evolution/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/trailofbits/skills/blob/main/plugins/trailmark/skills/graph-evolution/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œCompare the code structure between v1.2 and v1.3 and tell me if any new attack paths appeared.”

5 new skills a week. 1 minute to read.

How it works

It builds a code graph for each version, then compares them to find new entry paths, complexity changes, and shifts in how data and permissions flow.

Technical content (original SKILL.md)

Original text by the author, straight from 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
FAQ

Can it compare folders as well as git refs?

The skill says it works with git commits, tags, or directories.

Does it replace reading the code diff?

No. It adds a structural view, and line-by-line review is still needed.

Does it check general code quality?

No. It focuses on security-relevant changes such as attack paths and privilege boundaries.

Details

Original description by the author

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

Popularity

GitHub stars
8.0k
Ranking position
#12729
License
CC-BY-SA-4.0
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills