graph-evolution skill
✓ 공식scripts두 소스 스냅샷 간의 코드 그래프를 비교하여 새로운 공격 경로 및 권한 경계 수정과 같은 보안 관련 구조적 변경 사항을 탐지합니다.
- GitHub 스타
- 8,136
- 파일
- 6
- 마지막 커밋
- 2026년 11월 11일
- 라이선스
- CC-BY-SA-4.0
- 허용된 도구
- —
graph-evolution skill은 무엇을 하나요?
graph-evolution은(는) agent skill입니다. 두 소스 스냅샷 간의 코드 그래프를 비교하여 새로운 공격 경로 및 권한 경계 수정과 같은 보안 관련 구조적 변경 사항을 탐지합니다.
skill의 SKILL.md에서 생성된 요약입니다.
graph-evolution skill 정보
코드 업데이트 중에 구조적 취약점을 식별해야 하는 보안 엔지니어와 개발자는 이 SKILL을 사용하여 두 스냅샷 간의 코드 그래프를 비교할 수 있습니다. git commit, tag 또는 디렉토리를 분석함으로써 새로운 공격 경로, 권한 경계 수정, 오염 전파 변화와 같이 표준 텍스트 diff가 놓치기 쉬운 보안 관련 변경 사항을 찾아냅니다.
에이전트는 릴리스 전 구조 비교를 수행하거나 공격 표면 확대를 확인하기 위해 커밋 범위를 감사할 때 이 SKILL을 로드해야 합니다. 프로세스는 두 스냅샷 모두에 대해 Trailmark 코드 그래프를 구축하고, 영향 범위 및 복잡도와 같은 지표를 계산하기 위해 사전 분석을 실행한 다음, 구조적 diff를 계산하는 과정을 포함합니다. 이 도구는 trailmark 설치를 기반으로 하며 상세한 JSON diff와 보안 중심의 markdown 보고서를 생성합니다. 특히 노드가 오염된 세트나 높은 영향 범위 세트에 포함되는 것과 같은 서브그래프 멤버십의 변화를 식별하여, 라인 단위 리뷰보다 더 깊은 수준의 분석을 제공합니다.
agent가 수행할 수 있는 작업
- 1새로운 공격 경로 탐지최근 코드 변경으로 인해 공격자가 민감한 함수에 도달할 수 있는 새로운 경로가 생성되었는지 확인합니다.
- 2영향 범위 확대 추적구조적 변경으로 인해 시스템에 미치는 잠재적 영향력이 조용히 증가한 함수를 찾습니다.
- 3오염 전파 변화 감사코드베이스의 서로 다른 버전 간에 데이터 흐름 특성이 변경되었는지 확인합니다.
skill의 SKILL.md를 기반으로 작성되었습니다. 모든 사용 사례는 해당 문서의 인용구와 대조 확인되었습니다.
graph-evolution skill 설치 방법
각 명령은 skill 폴더를 클라이언트의 skills 디렉터리에 복사합니다. 클라이언트를 재시작하거나 새 세션을 시작하여 로드하세요.플러그인에 graph-evolution skill 설치
/plugin marketplace add trailofbits/skills /plugin install trailmark@trailofbits
Claude Code에 graph-evolution skill 설치
~/.claude/skills/graph-evolution/SKILL.md
$ npx degit trailofbits/skills/plugins/trailmark/skills/graph-evolution ~/.claude/skills/graph-evolutionClaude Code (project)에 graph-evolution skill 설치
.claude/skills/graph-evolution/SKILL.md
$ npx degit trailofbits/skills/plugins/trailmark/skills/graph-evolution .claude/skills/graph-evolutionCodex에 graph-evolution skill 설치
~/.agents/skills/graph-evolution/SKILL.md
$ npx degit trailofbits/skills/plugins/trailmark/skills/graph-evolution ~/.agents/skills/graph-evolutionGemini CLI에 graph-evolution skill 설치
~/.gemini/skills/graph-evolution/SKILL.md
$ npx degit trailofbits/skills/plugins/trailmark/skills/graph-evolution ~/.gemini/skills/graph-evolutionClaude.ai에 graph-evolution skill 설치
npx degit trailofbits/skills/plugins/trailmark/skills/graph-evolution graph-evolution && zip -r graph-evolution.zip graph-evolution # claude.ai → Customize → Skills → + → Create skill → Upload a skill → graph-evolution.zip
자동 검사
2026년 11월 15일에 실행됨전체 보고서 →아직 검증되지 않았습니다. 스킬은 점수 80, 심각한 발견 없음, 검사에 충분한 데이터가 필요합니다. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능trailofbits/skills/plugins/trailmark/skills/graph-evolution is public and reachablegithub.com/trailofbits/skills/tree/HEAD/plugins/trailmark/sk ↗통과
- 오픈 소스 라이선스 (OSI)CC-BY-SA-4.0 is not OSI-approvedspdx.org/licenses/CC-BY-SA-4.0.html ↗결함 발견
- 최근 1년 내 커밋 또는 릴리스Last commit 2026-11-11github.com/trailofbits/skills/commits ↗통과
- 스크립트에 다운로드 후 실행이나 자격 증명 탈취가 없음1 script read; no download-and-run, remote eval, base64 execution or credential upload통과
- SKILL.md에 숨겨진 지침 없음No override phrases, safeguard switches, credential requests or hidden charactersgithub.com/trailofbits/skills/blob/HEAD/plugins/trailmark/sk ↗통과
- 사전 허용 도구가 제한됨No pre-approved tools; the agent asks before using onegithub.com/trailofbits/skills/blob/HEAD/plugins/trailmark/sk ↗통과
- SKILL.md가 Agent Skills 형식을 따름Valid name and description; says when to use it; 353 linesgithub.com/trailofbits/skills/blob/HEAD/plugins/trailmark/sk ↗통과
SKILL.md
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-reviewfor text-diff analysis) - Single-snapshot analysis (use the
trailmarkskill directly) - Diagram generation from a single snapshot (use the
diagramming-codeskill) - Mutation testing triage (use the
genotoxicskill)
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 trailmark.query.api import QueryEngine
def build_and_export(target_dir, output_path, language="auto"):
"""Build graph, run pre-analysis, export JSON."""
engine = QueryEngine.from_directory(target_dir, language=language)
engine.preanalysis()
json_str = engine.to_json()
with open(output_path, "w") as f:
f.write(json_str)
return engine.summary()
import tempfile, os
work_dir = tempfile.mkdtemp(prefix="trailmark_evolution_")
before_json = os.path.join(work_dir, "before_graph.json")
after_json = os.path.join(work_dir, "after_graph.json")
before_summary = build_and_export(
"{before_dir}", before_json
)
after_summary = build_and_export(
"{after_dir}", after_json
)
Verify both graphs built successfully by checking the summary output.
If either fails, rerun with an explicit language or comma-separated list
instead of auto.
Phase 3: Compute Structural Diff
Run both:
- Trailmark's native structural diff for nodes, edges, and entrypoints
- The plugin's
graph_diff.pyhelper for subgraph membership changes
Use the same work_dir from Phase 2, and pass the same --language value Phase 2
built with. trailmark diff defaults that flag to python, so on any other
target the default exits 0 and writes empty arrays rather than reporting a
mismatch.
trailmark diff --json --language auto "{before_dir}" "{after_dir}" > "{work_dir}/trailmark_diff.json" || \
uv run trailmark diff --json --language auto "{before_dir}" "{after_dir}" > "{work_dir}/trailmark_diff.json"
uv run {baseDir}/scripts/graph_diff.py \
--before "{before_json}" \
--after "{after_json}" > "{work_dir}/subgraph_diff.json"
If Phase 2 needed an explicit language or a comma-separated list instead of
auto, use that same value here.
If either diff command fails or writes an empty JSON file, stop and report the error instead of continuing to Phase 4.
A trailmark_diff.json whose nodes, edges, and entrypoints arrays are all
empty means either nothing changed structurally or both snapshots parsed to
(near-)empty graphs. Decide which using Phase 2's graph summaries: if either
snapshot's node count is zero or implausibly small for the target, the parse
missed the code — name the language set explicitly (rust, solidity,
python,rust) and re-run. Healthy node counts on both snapshots plus an empty
diff is genuine structural stability.
The native Trailmark diff contains:
| Key | Contents |
|---|---|
summary_delta |
Changes in node/edge/entrypoint counts |
nodes.added |
New functions, classes, methods |
nodes.removed |
Deleted functions, classes, methods |
nodes.modified |
Functions with changed CC, params, line span |
edges.added |
New call/inheritance/import relationships |
edges.removed |
Deleted relationships |
entrypoints |
Added, removed, and modified entrypoints |
The subgraph diff contains:
| Key | Contents |
|---|---|
subgraphs |
Per-subgraph membership changes (tainted, high_blast_radius, etc.) |
Phase 4: Interpret Diff and Generate Report
Read both diff JSON files and generate a security-focused markdown report. See references/report-format.md for the full template.
Interpretation priorities (highest to lowest):
- New tainted paths — nodes entering the
taintedsubgraph, especially if they also appear in added edges targeting sensitive functions - Privilege boundary changes — new or removed trust transitions from the native entrypoint/edge diff plus the subgraph diff
- Attack surface growth — new entrypoints, especially
untrusted_external, fromtrailmark_diff.json - Blast radius increases — nodes entering
high_blast_radius - Complexity spikes — CC increases > 3 on tainted or entrypoint-reachable nodes
- Structural additions — new nodes and edges (review needed)
- Structural removals — verify removed security functions were replaced
Cross-reference structural changes with git diff {before_ref}..{after_ref}
to add source-level context to findings.
Severity classification:
| Severity | Structural Signal |
|---|---|
| CRITICAL | New tainted path to sensitive function, removed auth boundary |
| HIGH | New entrypoint + high blast radius, large CC increase on tainted node |
| MEDIUM | New trust-boundary-crossing edges, moderate CC increase |
| LOW | Added nodes without entrypoint reachability |
| INFO | Dead code removal, complexity reductions |
For detailed metric definitions, see references/evolution-metrics.md.
Phase 5: Clean Up
Remove git worktrees after the report is written:
git worktree remove "{before_dir}"
git worktree remove "{after_dir}"
Diff Reference
trailmark diff --json --language auto BEFORE AFTER
uv run {baseDir}/scripts/graph_diff.py [OPTIONS]
trailmark diff --language defaults to python. On a target in any other
language that default still exits 0, emitting well-formed JSON with empty
nodes, edges, and entrypoints arrays, so always pass the flag: auto
detects and merges every supported language found under the target, and a single
name (rust, solidity) or comma-separated list (python,rust) pins an
explicit set. auto fails loudly with No supported languages detected under <path> when a snapshot holds nothing it can parse, which is the outcome you
want. Confirm the language first; only then can an empty diff count as evidence
that nothing changed.
Use trailmark diff for:
- Node/edge changes
- Added/removed/modified entrypoints
- Human-readable structural diff reports
Use graph_diff.py for:
- Subgraph membership changes derived from
engine.preanalysis() tainted,high_blast_radius,privilege_boundary, and related sets
| Argument | Default | Description |
|---|---|---|
--before |
required | Path to the "before" graph JSON |
--after |
required | Path to the "after" graph JSON |
--indent |
2 |
JSON output indentation |
graph_diff.py input format: Trailmark JSON exports from engine.to_json().
graph_diff.py output: JSON structural diff for nodes, edges, and subgraphs.
Quality Checklist
Before delivering the report:
- Both graphs built successfully (check summaries)
- Pre-analysis ran on both snapshots
- Native Trailmark diff computed (
trailmark_diff.json); if it is empty, both snapshots' Phase 2 node counts were non-zero, so empty means stable - Subgraph diff computed and non-empty (
subgraph_diff.json) - All subgraph changes interpreted (tainted, blast radius, etc.)
- Critical findings include evidence (node IDs, edge diffs)
- Severity levels assigned to all findings
- Source-level context added via git diff cross-reference
- Worktrees cleaned up (or temp dirs removed)
- Report written to
GRAPH_EVOLUTION_*.md
Integration
trailmark skill: Phase 2 uses the trailmark API for graph building and pre-analysis. All trailmark query patterns work on either snapshot's engine.
differential-review skill: Use graph-evolution for structural analysis, differential-review for line-level code review. The two are complementary — graph-evolution finds attack paths that text diffs miss, while differential-review provides git blame context and micro-adversarial analysis.
trailmark-review-gate skill: Use trailmark-review-gate after graph-evolution when a branch, pull request, fix commit, or release diff needs a PASS/WARN/FAIL/UNKNOWN structural review packet. The gate applies deterministic review rules to graph-evolution output; it does not replace human review.
genotoxic skill: If graph-evolution reveals new high-CC tainted nodes, feed them to genotoxic for mutation testing triage.
diagramming-code skill:
Generate before/after diagrams to visualize structural changes.
Use call-graph or data-flow diagrams focused on changed nodes.
Supporting Documentation
- references/evolution-metrics.md — What each structural metric means and why it matters for security
- references/report-format.md — Report template, severity classification, and example findings
이 스킬의 파일
6graph-evolution skill 질문
Claude Code에 graph-evolution skill을 어떻게 설치하나요?
npx degit trailofbits/skills/plugins/trailmark/skills/graph-evolution ~/.claude/skills/graph-evolution를 실행합니다. Claude Code는 ~/.claude/skills(모든 프로젝트) 또는 .claude/skills(한 프로젝트)에서 skills를 로드하며, 설명이 작업과 일치할 때 skill을 사용합니다.
graph-evolution skill을 사용할 수 있는 클라이언트는 무엇인가요?
Agent Skills 형식을 읽는 모든 클라이언트(Claude Code, Codex, Gemini CLI, claude.ai(ZIP으로 업로드))가 사용할 수 있습니다. skill 내 스크립트는 클라이언트가 코드 실행을 허용하는 경우에만 실행됩니다.
표준 텍스트 diff로 탐지할 수 없는 무엇을 이 도구는 찾아낼 수 있나요?
새로운 공격 경로, 복잡도 변화, 영향 범위(blast radius) 확대, 오염 전파(taint propagation) 변화, 권한 경계 수정과 같은 구조적 변화를 드러냅니다.
코드가 변경되었음에도 diff 결과가 비어 있을 수 있는 이유는 무엇인가요?
이 도구는 기본적으로 Python을 대상으로 합니다. 다른 언어로 작성된 코드를 분석하려면 --language 플래그를 명시적으로 전달해야 하며, 그렇지 않으면 빈 diff를 반환하며 종료될 수 있습니다.
서로 다른 두 git 브랜치를 비교하려면 어떻게 해야 하나요?
그래프를 생성하기 전에 git worktree를 사용하여 각 참조를 별도의 디렉토리에 깨끗한 복사본으로 만들어야 합니다.