Loading...
Loading...
Builds and queries multi-language source code graphs for security analysis. Includes pre-analysis passes for blast radius, taint propagation, privilege boundaries, and entry point enumeration. Use when analyzing call paths, mapping attack surface, finding complexity hotspots, enumerating entry points, tracing taint propagation, measuring blast radius, or building a code graph for audit prioritization. Supports 16 languages including Solidity, Cairo, Circom, Rust, Go, Python, C/C++, TypeScript.
npx skill4agent add trailofbits/skills trailmarkdiagramming-code| Rationalization | Why It's Wrong | Required Action |
|---|---|---|
| "I'll just read the source files manually" | Manual reading misses call paths, blast radius, and taint data | Install trailmark and use the API |
| "Pre-analysis isn't needed for a quick query" | Blast radius, taint, and privilege data are only available after | Always run |
| "The graph is too large, I'll sample" | Sampling misses cross-module attack paths | Build the full graph; use subgraph queries to focus |
| "Uncertain edges don't matter" | Dynamic dispatch is where type confusion bugs hide | Account for |
| "Single-language analysis is enough" | Polyglot repos have FFI boundaries where bugs cluster | Use the correct |
| "Complexity hotspots are the only thing worth checking" | Low-complexity functions on tainted paths are high-value targets | Combine complexity with taint and blast radius data |
uv run trailmarkuv pip install trailmark# Python (default)
uv run trailmark analyze --summary {targetDir}
# Other languages
uv run trailmark analyze --language rust {targetDir}
uv run trailmark analyze --language javascript {targetDir}
uv run trailmark analyze --language go --summary {targetDir}
# Complexity hotspots
uv run trailmark analyze --complexity 10 {targetDir}from trailmark.query.api import QueryEngine
# Specify language (defaults to "python")
engine = QueryEngine.from_directory("{targetDir}", language="rust")
engine.callers_of("function_name")
engine.callees_of("function_name")
engine.paths_between("entry_func", "db_query")
engine.complexity_hotspots(threshold=10)
engine.attack_surface()
engine.summary()
engine.to_json()
# Run pre-analysis (blast radius, entrypoints, privilege
# boundaries, taint propagation)
result = engine.preanalysis()
# Query subgraphs created by pre-analysis
engine.subgraph_names()
engine.subgraph("tainted")
engine.subgraph("high_blast_radius")
engine.subgraph("privilege_boundary")
engine.subgraph("entrypoint_reachable")
# Add LLM-inferred annotations
from trailmark.models import AnnotationKind
engine.annotate("function_name", AnnotationKind.ASSUMPTION,
"input is URL-encoded", source="llm")
# Query annotations (including pre-analysis results)
engine.annotations_of("function_name")
engine.annotations_of("function_name",
kind=AnnotationKind.BLAST_RADIUS)
engine.annotations_of("function_name",
kind=AnnotationKind.TAINT_PROPAGATION)engine.preanalysis()diagramming-code| Language | | Extensions |
|---|---|---|
| Python | | |
| JavaScript | | |
| TypeScript | | |
| PHP | | |
| Ruby | | |
| C | | |
| C++ | | |
| C# | | |
| Java | | |
| Go | | |
| Rust | | |
| Solidity | | |
| Cairo | | |
| Haskell | | |
| Circom | | |
| Erlang | | |
functionmethodclassmodulestructinterfacetraitenumnamespacecontractlibrarycallsinheritsimplementscontainsimportscertainself.method()inferreduncertainassumptionpreconditionpostconditioninvariantblast_radiusprivilege_boundarytaint_propagationuncertainengine.subgraph("name")engine.preanalysis()