Generated banner for Trailmark Finding Triage
Generated logo for Trailmark Finding Triage

Trailmark Finding Triage

Trail of BitsOfficialPublished by Trail of Bits

  • Skill
  • Workflow
  • Security
  • CC-BY-SA-4.0
  • Low risk
  • Has scripts

From the author

Performs graph-assisted triage of a single security finding, SARIF result, weAudit annotation, suspicious function, or report excerpt using Trailmark reachability, entrypoint paths, taint, privilege-boundary, blast-radius, caller/callee, and neighborhood evidence. Use when deciding whether one candidate issue is reachable, prioritizing a finding before PoC work, preparing evidence for exploit validation, or checking whether a static-analysis result is actionable.
— the description by Trail of Bits

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

Trailmark Finding Triage provides a structured workflow to evaluate individual security findings by leveraging graph-based code analysis. It helps security researchers and developers determine if a reported issue is reachable from an entrypoint, assess its potential impact, and decide whether it warrants further investigation or proof-of-concept development. By binding findings to specific nodes in a Trailmark graph, the skill generates evidence packets that highlight entrypoint paths, taint, privilege boundaries, and blast radius, allowing for informed decisions on whether to promote, deprioritize, or manually review a candidate issue.

What it does

  • Normalizes security findings from various sources like SARIF, weAudit, or manual reports.
  • Binds candidate findings to specific nodes within a Trailmark graph.
  • Analyzes reachability, taint, and privilege boundaries for a single finding.
  • Generates a structured evidence packet to support triage decisions.
  • Provides a clear verdict on whether to promote, review, or deprioritize an issue.
  • Identifies specific manual review targets such as validators or auth checks.

When to use it

  • When you need to triage a static-analysis result before investing time in PoC development.
  • When checking if a manually discovered issue is reachable from an entrypoint.
  • When building an evidence packet to prepare for exploit validation.
  • When reviewing a single suspicious function identified during a manual audit.

Advantages

  • Reduces time spent on non-reachable or low-impact findings.
  • Provides objective graph evidence to support triage decisions.
  • Standardizes the output format for security findings and evidence.
  • Helps distinguish between reachable code and actual exploitable vulnerabilities.

Usage examples

“Use Trailmark finding triage on src/Vault.sol:148; I think withdraw can bypass the balance update.”
The agent binds the finding to the node, analyzes reachability and entrypoint paths, and provides a verdict on whether the issue is worth further investigation.
“Triage this SARIF result before I spend PoC time: semgrep:error unchecked-transfer in contracts/Bridge.sol line 91.”
The agent processes the SARIF input, maps it to the graph, and generates an evidence packet detailing if the transfer is reachable and attacker-controlled.
“This report excerpt claims parse_packet is attacker reachable. Build the Trailmark evidence packet and tell me what is still missing.”
The agent analyzes the function in the graph context, reports on entrypoint reachability, and lists remaining manual review targets needed to confirm exploitability.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/trailofbits/trailmark-finding-triage/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip trailmark-finding-triage.zip -d .agents/skills

Documentation by Trail of Bits

Trailmark Finding Triage

Build a concise graph evidence packet for one candidate finding. This skill answers whether the affected code is reachable, what graph evidence supports or weakens the claim, and what manual review is still required before calling the issue exploitable.

When to Use

  • Triage one static-analysis result before spending PoC time

  • Check whether a manual finding is entrypoint-reachable

  • Build an evidence packet for PoC work

  • Review a single suspicious function discovered during manual audit

  • Decide whether one issue should be promoted, deprioritized, or treated as part of a broader chain analysis

When NOT to Use

  • Multiple weak findings might compose into a stronger chain. Use a chain or composition workflow instead.

  • The user wants a full audit. Use an audit or design-review workflow instead.

  • The user wants remediation verification for a known finding. Use a remediation-review workflow instead.

  • The target is a PR or branch diff. Use graph-evolution plus a differential review workflow.

  • No concrete finding, function, file/line, or suspicious sink exists yet. Use discovery skills first.

Rationalizations to Reject

RationalizationWhy It Is WrongRequired Action
"The scanner says high severity, so reachability is obvious"Static findings need graph and code context before promotionBind the finding to a graph node and check entrypoint paths
"No entrypoint path means impossible"It may mean parser, proxy, or dynamic dispatch limitationsReport the limitation separately from reachability
"An auth check appears on the path, so the issue is safe"The check may enforce the wrong predicate or be bypassed by another pathTreat validation/auth as review targets, not proof
"One reachable path is enough for a PoC claim"The path still needs attacker-controlled inputs and compatible preconditionsSeparate graph reachability from exploitability
"This is probably a chain"Single-finding triage stops at one candidateHand off related findings to a composition workflow

Workflow

Finding Triage Progress:
- [ ] Step 1: Normalize the candidate
- [ ] Step 2: Build or reuse the Trailmark graph
- [ ] Step 3: Bind the candidate to graph node(s)
- [ ] Step 4: Analyze reachability, taint, boundaries, and blast radius
- [ ] Step 5: Decide and emit the evidence packet
Step 1: Normalize the Candidate

Accept file/line, function name, SARIF result, weAudit annotation, Markdown finding excerpt, or a manual claim. Normalize it to:

  • title

  • source type

  • file path and line range if present

  • function or node hint

  • suspected source, sink, or asset

  • claimed impact

If there is no concrete code anchor, stop and ask for one.

For input handling details, see references/input-normalization.md.

Shortcut for Steps 2–4 (file/line findings)

For file/line anchors, run the bundled script. It builds the graph and preanalysis once, binds every finding, and prints the Graph Evidence fields as JSON: all matching nodes and the primary one (the node containing the first line, then the narrowest), entrypoint paths with each entrypoint's trust level, tainted / entrypoint_reachable / privilege_boundary / high_blast_radius membership, callers, callees, downstream nodes, and the Trailmark version. Pass several findings in one call rather than rebuilding the graph per finding.

uv run --no-project "{baseDir}/scripts/evidence_packet.py" --target <dir> --finding <file>:<line>[-<end>] --out evidence.json [--finding ...] [--language auto]

With --out, the complete packet stays on disk and stdout contains only delivery counts. Read relevant finding records from that file. Without --out, stdout is the full packet. Relative anchors may be target- or working-directory-relative; ambiguous existing paths are rejected. Choose --path-base target or cwd, or use an absolute path. Lines must be positive and ordered; column syntax is not supported. Containers cover module/class/contract declarations when no callable overlaps. Inspect binding (exact, nested or ambiguous), binding_kind, all matches, unavailable signals and parser diagnostic limitations before judging the result. A zero-node graph is a failure. Batching shares graph work only: write a separate human verdict for each finding.

A finding that binds to nothing comes back with bound_node: null and the reason. The script judges nothing: read the bound code and its callers, decide attacker control, and treat an empty path list as a limitation to explain (dynamic dispatch, proxies, missing entrypoint models), not as proof. Use the steps below for inputs the script does not take (function names, SARIF via audit-augmentation) and for queries it does not run (connect_subgraphs).

Step 2: Build Or Reuse The Graph

Use the public trailmark skill workflow. Prefer an existing fresh exported graph or .trailmark/ artifact when present. Otherwise build a graph with language="auto" or the target's explicit language list, then run engine.preanalysis().

Record the Trailmark version or feature probes used. Feature-gate Trailmark 0.4-only APIs with hasattr() or CLI help checks.

Step 3: Bind The Candidate

Bind by file and line overlap first, then function name plus file. If several nodes match, list every candidate and select the narrowest enclosing node as primary. If no node matches, report a binding limitation instead of guessing.

SARIF and weAudit users should reuse the audit-augmentation workflow for matching and then inspect the annotated node.

Step 4: Analyze Graph Evidence

Run the query recipe in references/query-recipes.md:

  • entrypoint paths to the bound node

  • trust level of each path when available

  • membership in tainted, privilege_boundary, and high_blast_radius subgraphs

  • direct callers and callees

  • high-impact downstream sinks

  • sibling or nearby nodes worth manual review

Do not treat graph reachability as proof of exploitability.

Step 5: Decide And Handoff

Produce one verdict:

VerdictMeaning
PromoteGraph evidence supports reachability and plausible impact
Needs manual reviewEvidence is suggestive but not decisive
DeprioritizeNo reachable path or only trusted/internal paths found
BlockedBinding or Trailmark analysis failed

Write the evidence packet using references/output-format.md.

Hand off promoted PoC-worthy issues to the user's PoC workflow. Hand off related findings to a composition workflow. Hand off repeatable root causes to trailmark-variant-neighborhood, variant-analysis, or a custom Semgrep/CodeQL rule workflow.

Example Prompts

  • "Use Trailmark finding triage on src/Vault.sol:148; I think withdraw can bypass the balance update."

  • "Triage this SARIF result before I spend PoC time: semgrep:error unchecked-transfer in contracts/Bridge.sol line 91."

  • "This report excerpt claims parse_packet is attacker reachable. Build the Trailmark evidence packet and tell me what is still missing."

Files

scripts/test_evidence_packet.py

"""Tests for evidence_packet.py: one graph build, exact binding, evidence fields per finding."""

from __future__ import annotations

import argparse
import importlib.util
import json
import re
import shutil
import subprocess
import sys
import types
from pathlib import Path

import pytest

SCRIPT = Path(__file__).resolve().parent / "evidence_packet.py"


def uv() -> str:
    # Fail rather than skip: a skipped run leaves the script unexercised while CI is green.
    path = shutil.which("uv")
    if path is None:
        pytest.fail("uv is not on PATH; evidence_packet.py runs under `uv run`")
    return path


APP = """from flask import Flask, request

from .store import load, parse

app = Flask(__name__)


@app.route("/upload", methods=["POST"])
def upload():
    return parse(request.get_data())


@app.route("/item/<key>")
def item(key):
    return load(key)
"""
STORE = """import pickle


def parse(blob):
    return pickle.loads(blob)


def load(key):
    def inner(k):
        return open("/data/" + k).read()

    return inner(key)


def unused(expr):
    return eval(expr)
"""


@pytest.fixture(scope="module")
def project(tmp_path_factory) -> Path:
    root = tmp_path_factory.mktemp("proj with space")
    pkg = root / "svc"
    pkg.mkdir()
    (pkg / "__init__.py").write_text("")
    (pkg / "app.py").write_text(APP)
    (pkg / "store.py").write_text(STORE)
    (root / "NOTES.txt").write_text("not code\n")
    return root


def run(project: Path, *findings: str, extra: tuple[str, ...] = ()) -> subprocess.CompletedProcess:
    args = [a for f in findings for a in ("--finding", f)]
    return subprocess.run(
        [
            uv(),
            "run",
            "--quiet",
            "--no-project",
            str(SCRIPT),
            "--target",
            str(project),
            "--language",
            "python",
            *args,
            *extra,
        ],
        capture_output=True,
        text=True,
    )


@pytest.fixture(scope="module")
def packet(project) -> dict:
    proc = run(project, "svc/store.py:5", "svc/store.py:5-9", "svc/store.py:16", "NOTES.txt:1")
    assert proc.returncode == 0, proc.stderr
    return json.loads(proc.stdout)


def test_reachable_sink_has_paths_and_taint(packet):
    f = packet["findings"][0]
    assert f["bound_node"] == "svc.store:parse" and f["binding"] == "exact"
    assert [p["path"] for p in f["entrypoint_paths"]] == [["svc.app:upload", "svc.store:parse"]]
    assert f["entrypoint_paths"][0]["trust_level"] == "untrusted_external"
    assert f["tainted"] is True and f["entrypoint_reachable"] is True
    assert f["callers"] == ["svc.app:upload"]
    assert packet["trailmark_version"].startswith("0.5")


def test_range_spanning_two_functions_lists_both_and_picks_narrowest(packet):
    f = packet["findings"][1]
    ids = [m["id"] for m in f["matches"]]
    assert set(ids) == {"svc.store:parse", "svc.store:load"}
    assert f["bound_node"] == "svc.store:parse" and f["binding"].startswith("ambiguous")


def test_dead_code_has_no_paths(packet):
    f = packet["findings"][2]
    assert f["bound_node"] == "svc.store:unused"
    assert f["entrypoint_paths"] == [] and f["callers"] == [] and f["entrypoint_reachable"] is False


def test_non_source_anchor_is_unbound(packet):
    f = packet["findings"][3]
    assert f["bound_node"] is None and "not in the graph" in f["binding"]


def test_absolute_paths_and_out_file(project, tmp_path):
    out = tmp_path / "ev.json"
    proc = run(project, f"{project}/svc/store.py:5", extra=("--out", str(out)))
    assert proc.returncode == 0, proc.stderr
    assert json.loads(out.read_text())["findings"][0]["bound_node"] == "svc.store:parse"


def test_bad_arguments(project, tmp_path):
    assert run(project, "svc/store.py").returncode == 2
    proc = subprocess.run(
        [
            uv(),
            "run",
            "--quiet",
            str(SCRIPT),
            "--target",
            str(tmp_path / "nope"),
            "--finding",
            "a.py:1",
        ],
        capture_output=True,
        text=True,
    )
    assert proc.returncode == 2 and "not a directory" in proc.stderr


def test_module_declaration_binds_and_diagnostics_are_explicit(project):
    proc = run(project, "svc/store.py:1")
    assert proc.returncode == 0, proc.stderr
    packet = json.loads(proc.stdout)
    assert packet["findings"][0]["binding_kind"] == "module"
    assert packet["graph"]["parser_diagnostics_available"] is False
    assert packet["graph"]["limitations"]


def test_subdirectory_target_and_ambiguous_paths(project, monkeypatch, tmp_path):
    monkeypatch.chdir(project)
    proc = run(project / "svc", "svc/store.py:5")
    assert proc.returncode == 0, proc.stderr
    assert json.loads(proc.stdout)["findings"][0]["bound_node"] == "store:parse"
    (tmp_path / "store.py").write_text("def other():\n    pass\n")
    monkeypatch.chdir(tmp_path)
    proc = run(project / "svc", "store.py:5")
    assert proc.returncode == 2 and "ambiguous path" in proc.stderr
    proc = run(project / "svc", "store.py:5", extra=("--path-base", "target"))
    assert proc.returncode == 0, proc.stderr
    assert json.loads(proc.stdout)["findings"][0]["bound_node"] == "store:parse"


@pytest.mark.parametrize("anchor", ["svc/store.py:0", "svc/store.py:9-4", "svc/store.py:5:2"])
def test_invalid_ranges_and_columns_fail_before_graph(project, anchor, monkeypatch):
    spec = importlib.util.spec_from_file_location("packet_test", SCRIPT)
    module = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(module)
    api = types.ModuleType("trailmark.query.api")
    api.QueryEngine = types.SimpleNamespace(
        from_directory=lambda *_a, **_kw: pytest.fail("graph built for invalid argument")
    )
    monkeypatch.setitem(sys.modules, "trailmark", types.ModuleType("trailmark"))
    monkeypatch.setitem(sys.modules, "trailmark.query", types.ModuleType("trailmark.query"))
    monkeypatch.setitem(sys.modules, "trailmark.query.api", api)
    with pytest.raises(ValueError):
        module.build(argparse.Namespace(target=str(project), language="python", finding=[anchor]))


def test_container_and_procedure_binding_ignores_null_locations(tmp_path):
    spec = importlib.util.spec_from_file_location("packet_binding", SCRIPT)
    module = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(module)
    for kind in module.CALLABLE | module.CONTAINERS:
        nodes = {
            "item": {
                "id": "item",
                "kind": kind,
                "location": {"file_path": "a.sol", "start_line": 1, "end_line": 5},
            },
            "proxy": {"id": "proxy", "kind": "proxy", "location": None},
        }
        assert module.bind(nodes, "a.sol", 1, 1, tmp_path)[0]["kind"] == kind


def test_empty_graph_and_output_failure_are_clear(project, tmp_path):
    proc = run(project, "svc/store.py:5", extra=("--language", "solidity"))
    assert proc.returncode == 2 and "no nodes" in proc.stderr and not proc.stdout
    proc = run(project, "svc/store.py:5", extra=("--out", str(tmp_path)))
    assert proc.returncode == 2 and "cannot write" in proc.stderr
    assert "Traceback" not in proc.stderr


def test_output_summary_preserves_complete_packet(project, tmp_path):
    full = json.loads(run(project, "svc/store.py:5").stdout)
    out = tmp_path / "complete.json"
    proc = run(project, "svc/store.py:5", extra=("--out", str(out)))
    assert proc.returncode == 0, proc.stderr
    assert json.loads(out.read_text()) == full
    assert json.loads(proc.stdout)["complete_evidence_on_disk"] is True


def test_real_class_and_solidity_contract_declarations(tmp_path):
    (tmp_path / "a.py").write_text(
        "class Settings:\n    secret = 'example'\n    def read(self):\n        return self.secret\n"
    )
    proc = run(tmp_path, "a.py:1")
    assert proc.returncode == 0, proc.stderr
    assert json.loads(proc.stdout)["findings"][0]["binding_kind"] == "class"
    (tmp_path / "Vault.sol").write_text(
        "pragma solidity ^0.8.0;\ncontract Vault {\n uint public balance;\n"
        " function get() public view returns(uint) { return balance; }\n}\n"
    )
    proc = run(tmp_path, "Vault.sol:2", extra=("--language", "solidity"))
    assert proc.returncode == 0, proc.stderr
    finding = json.loads(proc.stdout)["findings"][0]
    assert finding["bound_node"] is not None and finding["binding_kind"] in ("contract", "class")


def test_nested_matches_are_labelled_nested_not_ambiguous(tmp_path):
    spec = importlib.util.spec_from_file_location("packet_nested", SCRIPT)
    module = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(module)

    def node(name, start, end):
        loc = {"file_path": "a.sol", "start_line": start, "end_line": end}
        return {"id": name, "kind": "function", "location": loc}

    nested = {"outer": node("outer", 1, 20), "inner": node("inner", 5, 8)}
    matches = module.bind(nested, "a.sol", 6, 6, tmp_path)
    assert [m["id"] for m in matches] == ["inner", "outer"]
    assert module.binding_label(matches) == "nested: 1 enclosing node(s)"
    siblings = {"a": node("a", 1, 3), "b": node("b", 5, 6)}
    matches = module.bind(siblings, "a.sol", 2, 6, tmp_path)
    assert matches[0]["id"] == "a"  # contains the first line, though "b" is narrower
    assert module.binding_label(matches).startswith("ambiguous")


RECIPES = SCRIPT.parent.parent / "references" / "query-recipes.md"


def test_query_recipes_run_on_trailmark_05(project):
    """The manual route must work too: run every recipe block from query-recipes.md."""
    blocks = re.findall(r"```python\n(.*?)```", RECIPES.read_text(), flags=re.S)
    code = "\n".join(blocks).replace("{targetDir}", str(project))
    code = code.replace('language="auto"', 'language="python"')
    code = code.replace("{bound_node}", "svc.store:parse")
    code += "\nimport json\nprint(json.dumps([tainted, entry_reachable, boundary, high_blast]))\n"
    proc = subprocess.run(
        [
            uv(),
            "run",
            "--quiet",
            "--no-project",
            "--with",
            "trailmark>=0.5,<0.6",
            "python",
            "-c",
            code,
        ],
        capture_output=True,
        text=True,
    )
    assert proc.returncode == 0, proc.stderr
    tainted, entry_reachable, boundary, high_blast = json.loads(proc.stdout.splitlines()[-1])
    assert tainted is True and entry_reachable is True
    assert boundary is False and high_blast is False

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Declares allowed tools, Needs Python, Needs Node.js

Security

What our scanner noticed· Low risk

  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Trail of Bits
Publisher
Trail of Bits (Official)
Source
trailofbits/skills · plugins/trailmark/skills/trailmark-finding-triage · commit e4dd0bb
Licence
Creative Commons Attribution-ShareAlike 4.0 International (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Trail of Bits or Trail of Bits.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download trailmark-finding-triage.zip