Skip to content

Releases

bastiontrace 0.6.1: a fuse trip no longer masks an earlier unblocked landing

Choose a tag to compare

@Rinkia Rinkia released this 09 Oct 13:10
4f29dce

Security fixes from an independent review of 0.6.0.

If you analyze bastionfuse trip snapshots, upgrade. 0.6.0 can report a real, unblocked
exfiltration as contained.

A fuse trip no longer masks an earlier unblocked landing

0.6.0 treated a fuse trip as the landing without comparing event order, so a forbidden call that
actually executed before the trip was hidden, and the report claimed containment for it:

#1  tool_call 'send_email' args={'to': 'evil@example.com'}   <- no verdict: it executed
#2  tool_call 'read'       verdict=tripped                   <- harmless, tripped the fuse

0.6.0:  [LANDED] (contained: the fuse blocked the call)   landing: #2
        ... and #1 is not marked at all

An analyst reads "contained" and closes the incident. No attacker is required — any
exfiltration that succeeded before a later trip hit this on honest traces.

A fuse blocks the call it trips on and vouches for nothing it allowed earlier. Earliest-wins now
holds across all three landing kinds, contained is claimed only for the landing the fuse
actually blocked, and a later trip is reported as a note:

0.6.1:  [LANDED]   landing: #1 - called forbidden tool 'send_email'
        note   : the fuse tripped later, at #2 (honeytoken #dead in the input of 'read');
                 it did not block this landing

The report can no longer be forged by trace content

A trace is attacker-influenceable input: everything in it is content an agent read. A fuse
reason containing a newline could print its own note : / blast : lines and emit real
terminal escape sequences (clear-screen, set-window-title). Every attacker-influenceable string
the human report prints now goes through one escaper that makes control characters visible and
caps length — including the pre-0.6.0 paths: tool_result content, agent names, source, notes
and args. --format json was never affected.

Honest verdicts on malformed and hostile traces

  • A fuse block with no call marked tripped was silently CLEAN — the same false-clean class
    0.6.0 set out to fix. A snapshot exists only because a tripwire fired, so an unlocatable trip
    (truncated or evicted ring) now reports ATTEMPTED with Finding.fuse_unresolved and a note.
  • Hostile header values raise ValueError naming the field, as the schema contract promised:
    non-object policy (was AttributeError), non-list or nested forbidden_tools /
    canary_tokens (was an unnamed TypeError), non-string canary / trace_id / source, and
    lone surrogates, which survive JSON parsing and then crash printing. A string
    forbidden_tools is refused instead of being split into single-character tool names, which had
    silently made a real landing read as CLEAN.
  • The CLI exits 2 for bad input, never a traceback. Exit 1 means LANDED, so a crash can
    never be mistaken for a finding — which matters because analyze is used as a CI gate.

Honest wording

The containment line now reads "the trace's fuse block records this call as blocked". The block is
a field in a file, and whoever wrote the file wrote it; nothing here verifies it, and snapshots
carry no signature. The README gains a Trusting a trace section stating what an analysis does
and does not prove.

Printing is also O(n) again rather than O(n²) on large traces.

123 tests, 97% coverage. Both original repros verified fixed, and a live bastionfuse honeytoken
trip still scores correctly.

pip install -U bastiontrace

bastiontrace 0.6.0: a fuse trip is a landing

Choose a tag to compare

@Rinkia Rinkia released this 08 Oct 09:37

A bastionfuse trip is now a landing.

bastionfuse writes a bastiontrace trace every time a tripwire fires. analyze scored those
files CLEAN unless the tripped tool happened to be a canary tool, because the honeytoken
that caused the trip is redacted out of the snapshot on purpose. The containment leg produced
forensic evidence that the forensics tool called clean. This release closes that.

Read-side only: bastionfuse 0.1.0 already writes everything needed, and bastiontrace was
dropping it.

$ bastiontrace analyze <fuse state dir>/trips/1760000000-ab12cd34ef.jsonl
trace 'fuse-ab12cd34ef-1760000000' (source=bastionfuse)  [LANDED]  (contained: the fuse blocked the call)
  #0   tool_call 'read_document' args={'path': 'notes.md'}
  #1   tool_call 'http_post' args={'body': '[HONEYTOKEN]'}  <== LANDING (fuse)
  landing: #1 - honeytoken #1a2b3c4d in the input of 'http_post'
  note   : landing found but no inject site located; source unknown

What's new

  • New landing kind fuse. With a fuse header block present, the call carrying
    verdict:"tripped" is the landing, and the fuse's own rule and reason are the signal. Its
    recorded decision is read, not re-derived: a tool-name match cannot name which tripwire
    fired, and re-deriving would mean searching for decoy strings and risking echoing live ones
    into a report.
  • Finding.contained. The payload reached a forbidden action and the fuse blocked the
    call. The verdict vocabulary stays LANDED / ATTEMPTED / CLEAN, so anything enforcing on
    it keeps working; the human report adds (contained: the fuse blocked the call) and the JSON
    gains the field.
  • Schema (additive). A fuse header block (rule, reason, session_sha256,
    honeytoken_sha256) and an optional tool_call.verdict (allowed | blocked | tripped).
    Hostile values raise a ValueError naming the field. A trace with neither is read, scored and
    serialized exactly as before.

Known ceilings

  • A snapshot yields a landing but no inject site and no causal path: the forensic ring holds
    tool calls with redacted args, not the content the agent read. Analyze the agent's own trace
    alongside the snapshot to get the path.
  • contained reports what the fuse recorded. bastiontrace does not verify the block
    independently.

Full notes in CHANGELOG.md; the wire format is in SCHEMA.md.

pip install -U bastiontrace

bastiontrace 0.5.0: multi-agent forensics + OTel import

Choose a tag to compare

@Rinkia Rinkia released this 30 Sep 08:19
d8b4fbb

Multi-agent forensics — schema v2 → v3 (additive) — and an OpenTelemetry import.

  • Schema v3. An optional agent field on every event. A new agent_message
    event (from_agent, to_agent, kind, derived_from): content one agent handed
    another, both an inject site and a propagation edge. A header provenance
    (explicit | inferred). Traces without v3 features are still written as
    v:2, byte-identical, so the bastionprobe contract golden is unchanged.
  • Cascade findings. patient_zero, agents_reached, hops and replicated
    (the worm signal: the injection re-sent by 2 or more agents, explicit provenance
    only). The human output gains a cascade: line.
  • from_otel / analyze --otel FILE. OTel GenAI spans (OTLP/JSON or Collector
    JSONL) become v3 traces:
    • events are ordered by span start/end, and provenance is inferred from the
      span tree (so findings are never linked);
    • system parts are skipped;
    • --forbid / --canary supply the policy;
    • a stderr warning and content_captured: false when the export has no content;
    • 200k-span cap, cycle-safe, malformed spans skipped.
  • Stricter reads. Provenance edges must point to an earlier seq. A header
    v newer than this reader, or an unknown event type, fails with an upgrade hint.
  • CLI. --example cascade|session-smuggling|clean-multiagent|otel-cascade|exfil
    runs bundled samples (now shipped in the wheel). analyze takes exactly one of
    trace files, --otel or --example. Bad input is one line on stderr with exit 2,
    not a traceback.
  • Faster. Edges are indexed once and a combined pre-filter skips clean text.
    A 200k-event trace analyzes in well under a second; the OTel import is linear.
  • Review fixes.
    • OTel ordering:
      • at equal timestamps, results and replies sort before new delegations;
      • a span with a missing or backwards end time is stretched to its last descendant.
    • OTel content:
      • delegations carry the parent's whole context, not just its reads since the
        last delegation;
      • JSON-shaped strings, kvlistValue/bytesValue attributes and non-content
        message parts are read, not dropped;
      • unnamed agents stay distinct.
    • Analysis:
      • replicated counts only messages downstream of the injection;
      • a forbidden call that happened before the first located injection is
        reported as a landing that is not attributed to it.
    • Input handling:
      • hostile field types in a trace are a one-line error (exit 2);
      • an unknown header provenance is rejected;
      • a loaded v:1 header is written back as v:1.
  • Next: bastionprobe multi-agent attack scenarios that emit v3 traces; OTel
    sample apps with content capture; per-agent drift baselines (deferred).

bastiontrace 0.4.0: harden emits policy v2

Choose a tag to compare

@Rinkia Rinkia released this 29 Sep 08:21
6d58ae3

harden emits policy_version: 2

  • Same decisions: default allow, and the tools an injection got called go on a deny list.
  • The file now starts with policy_version: 2, and an empty deny list is written deny: [].
  • It uses only the shared core, so every agentbastion and bastiongate version reads it: no consumer upgrade needed.

Contract: bastioncorpus CONTRACTS.md

v0.3.0

Choose a tag to compare

@Rinkia Rinkia released this 21 Sep 10:44
20ef230

Memory/summary as an inject-point type (BASTION_INTEL A1), schema v1 -> v2. New MemoryNote event models the agent memory/summary layer where compaction-summary injections hide. Analyzer scans it + honors source_seq provenance. Backward-compatible with v1 traces.

bastiontrace v0.2.0

Choose a tag to compare

@Rinkia Rinkia released this 11 Sep 15:30

Now depends on bastioncorpus (shared trilogy corpus) for injection signatures; built-in markers remain as fallback. See CHANGELOG.

v0.1.0 - agent injection forensics

Choose a tag to compare

@Rinkia Rinkia released this 11 Sep 13:43

bastiontrace v0.1.0

Forensics for injected AI agents. Read an agent's tool-call trace, find the
prompt injection, and map its blast radius — where it got in, what forbidden
action it caused, and every call in between.

This is the third and final leg of the bastion trilogy:

tool role question it answers
agentbastion prevent block it at runtime
bastionprobe attack which injections land?
bastiontrace investigate where did it get in, and what did it do?

What it does

Point it at a JSONL trace of an agent run and it derives four things with no LLM
and no dependencies:

  1. Inject point — the first tool output carrying a canary token or a known
    injection pattern.
  2. Landing — the first forbidden tool call (action) or leaked canary in a
    reply (leak). Earliest wins.
  3. Causal path — walks args_from provenance from the landing back to the
    inject (linked), or infers a direct edge when provenance is absent
    (inferred).
  4. Blast radius — the forward taint closure: every event the injection
    tainted.

Verdicts are LANDED, ATTEMPTED (injection present but no forbidden action),
or CLEAN. analyze exits non-zero when something landed, so it drops straight
into CI as a gate.

$ bastiontrace analyze examples/exfil.jsonl

trace 'exfil-1' (source=hand)  [LANDED]
  #0   user: Summarize the doc I fetched.
  #1   tool_result 'read_document': ...IGNORE PREVIOUS INSTRUCTIONS...   <== INJECT
  #2   tool_call 'search' args={'q': 'admin contact'}   .. tainted
  #3   tool_result 'search': admin@evil.com   .. tainted
  #4   tool_call 'send_email' args={'to': 'admin@evil.com'}   <== LANDING (action)
  #5   assistant: Done, emailed the admin.

  inject : #1 - canary token 'AGP-DEAD' in 'read_document' output
  landing: #4 - called forbidden tool 'send_email'
  path   : #1 -> #2 -> #3 -> #4  (linked)
  blast  : #1, #2, #3, #4

Closing the loop

bastiontrace harden turns a finding back into agentbastion defenses —
policy.yaml (deny the tools the injection reached) and injections.jsonl (the
attack strings, canary scaffolding stripped, in the SemanticDetector corpus
schema). These are the exact shapes bastionprobe harden emits, so the trilogy
is one dataflow:

bastionprobe attacks → serialize to a trace → bastiontrace locates it
and maps the blast radius → harden → agentbastion blocks → re-scan.

A bastionprobe result maps into a replayable trace via from_bastionprobe(), so
a red-team finding becomes a forensics case with no glue code.

Highlights

  • Zero dependencies, no LLM, offline. Pure analysis over a JSONL trace.
  • Portable trace schema (v1). One JSON object per line; a trace header
    then ordered message / tool_result / tool_call events. Full spec in
    SCHEMA.md.
  • CI gate. Non-zero exit on a landed injection.
  • Wire-compatible with the rest of the trilogy.

Install

pip install bastiontrace

Requires Python 3.10+. MIT licensed.

Known limits (v0.1.0)

  • The built-in injection-pattern set is deliberately small; canary tokens are
    the strongest signal. Broader corpus import is on the roadmap.
  • Single-agent traces only. agent_id, timestamps, and streaming deltas are
    additive schema extensions planned for later.