Skip to content

Add the Taint Barrier for agent tool calls - #786

Merged
gerardrecinto merged 2 commits into
masterfrom
taint-barrier
Nov 23, 2026
Merged

gerardrecinto merged 2 commits into
masterfrom
taint-barrier

Conversation

@gerardrecinto

Copy link
Copy Markdown
Collaborator

Adds the Taint Barrier, a new taint package: information-flow control plus tripwires for agent tool calls.

What it does

  • Labeled values (secret, pii, customer-data) are stored only as keyed HMAC-SHA256 fingerprints with a per-session key, covering plain, case/whitespace/zero-width changes, reversed, hex, percent-encoding, base64 (all alignments), base32, and chunks of 12+ characters for values of 24+.
  • Each tool call is checked. A labeled value going to a host, tool or file path the per-label JSON policy does not allow is blocked (default deny) with a reason code and no value in the output.
  • Honeytokens (fake AWS-, GitHub- and API-key-shaped credentials with a checksum marker) block on any appearance and raise an alert.
  • Every decision goes to the existing hash-chained audit log, masked with PIIRedactor, signed by the existing Ed25519 signer, and verifies offline.
  • Surfaces: Go API, sop-mcp-server taint check and taint honeytoken, a check_tool_call MCP tool (only when SOP_TAINT_POLICY and SOP_TAINT_VALUES are set), observe mode.
  • Homepage section "Try to steal the key": an in-browser simulation of the same rules with fake secrets, labeled as a simulation, with links to the package and the limits.
  • docs/SECURITY_CONTROLS.md has the matrix rows and an OWASP LLM01, LLM02, LLM06 note. No compliance claims.

Checked

  • go test -race -count=1 ./taint ./tools/mcpserver ./cmd/sop-mcp-server ./governance passes. taint coverage is 93.5%.
  • Table tests cover each encoding, chunked exfil, allowlisted and non-allowlisted sinks, userinfo and suffix host tricks, honeytoken trips, short-value refusal, no raw value in verdicts, receipts, alerts, errors or the exported log, tampered and re-hashed chains, audit failure, and 16 concurrent workers. FuzzNormalize found a real idempotency bug (stray bytes joining after a character is dropped), now fixed; both fuzz targets ran clean for 30 to 40 seconds after.
  • staticcheck v0.7.0 clean on the touched packages. gofmt clean. scripts/go-coverage-gate.sh passes with a new ./taint floor.
  • npx playwright test --project=chromium: 12 new tests pass (plain and encoded variants blocked, allowlist passes, decoy blocks, no console errors, no overflow at 375 and 1440, reduced motion, nothing sent over the network). Full chromium run: 285 passed, 2 skipped, 1 failure in playful.spec.ts (hero "Start over") that passed on rerun alone. a11y and seo specs for / pass.
  • demo/tailwind.css rebuilt with scripts/build-css.sh.

Limits

  • Exact match on the listed encodings only. No paraphrase, unlisted encodings, or data that was not labeled. Values under 8 characters are refused. Not a sandbox, and not an injection detector.
  • Nothing routes an agent's calls through it by default. The MCP tool is advice when the agent calls it itself.
  • I did not run the Windows or macOS CI legs locally, and go build ./... does not link on this machine because of the local cgo toolchain, so CI is the check for that.

No release, tag, publish or deploy.

Thanks,
Gerard

@gerardrecinto gerardrecinto self-assigned this Nov 23, 2026
Comment thread taint/honeytoken.go Fixed
Labeled values are kept as keyed fingerprints and blocked when a tool call sends them, in plain or encoded form, to a sink the per-label policy does not allow. Honeytokens block on any use. Decisions go to the hash-chained audit log with signed receipts. Adds a CLI check, an MCP tool, observe mode, a homepage demo and the controls matrix rows.
CodeQL flagged SHA-256 over the token body. The marker is only a label, so use FNV-1a in Go and in the page demo.
@gerardrecinto
gerardrecinto merged commit 6f3c027 into master Nov 23, 2026
38 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants