xtrom-engine
Deterministic runtime enforcement for AI agents. The security-critical core of Xtrom: it tracks data provenance (taint / information-flow control) and enforces policy at the tool-call boundary, so untrusted data can never parameterize a sensitive action and secrets can never leave via a non-allowlisted egress — regardless of how the request is worded.
This is the productized form of the CaMeL / IFC research line — a guarantee, not a guess. No ML required for the core guarantee (that's an optional enhancement layer). Zero runtime dependencies.
Why it matters
The #1 agentic risk (OWASP ASI01 2026) is goal hijacking via prompt injection — and real 2026 attacks (Agentjacking, Clinejection) hijacked coding agents through poisoned files/tickets. Content filters must recognise the malicious text; we make the attack a data-flow violation that's blocked structurally.
The proof (vs. a probabilistic guardrail)
On a mixed agent-attack corpus, deterministic enforcement wins where classifiers can't (reproduce it: ../xtrom-benchmark):
| Attack | detector score | guardrail-only | Xtrom | layer |
|---|---|---|---|---|
| indirect-injection exfil | 0.13 | ALLOW ✗ | BLOCK ✓ | L3 · taint/IFC |
| secret egress | 0.20 | ALLOW ✗ | BLOCK ✓ | L3 · secret-egress |
| out-of-scope tool call | 0.07 | ALLOW ✗ | BLOCK ✓ | L4 · scope |
| destructive prod action | 0.04 | ALLOW ✗ | STEP-UP ✓ | L4 · policy |
| blatant injection | 0.90 | BLOCK ✓ | BLOCK ✓ | L3 · taint/IFC |
100% attack containment vs 20% for guardrail-only · 4 deterministic-only catches · 0 false positives.
Quickstart
python3 -m pytest # the deterministic-guarantee, golden-vector and property tests
python3 demo.py # reproduces the exfil attack → deterministic BLOCK
Core API
from xtrom import Engine, Policy
eng = Engine(Policy.default(), identity="svc-claude-code", audit_path="audit.jsonl")
readme = eng.untrusted(open("README.md").read(), origin="file:README.md") # provenance in
url = eng.derive("https://attacker.io", [readme], "llm") # taint propagates
d = eng.authorize("http_post", {"url": url, "body": secret}) # → BLOCK (L3:taint/IFC)
What's here vs. the roadmap
- Now (v0.1): taint/IFC engine, deterministic policy (L3/L4), secret detection (L0), immutable audit log, tests, demo.
- Next: MCP gateway adapter, Python/TS SDK middleware (LangGraph/CrewAI/Bedrock), OPA/Rego policy bundles, ITDR (L5) + optional ML detectors (L1/L2). Hot path reimplemented in Go for the inline gateway.
See docs/reference/ARCHITECTURE.md for the full system and repo layout.
Policy versioning (P1 hardening)
Every Decision carries policy_version — the revision string of the bundle that produced it.
Engine is constructed with a Policy whose _meta.revision propagates onto every decision +
audit event, so post-hoc audit + SIEM can prove which policy applied to which action. The
Go gateway does the same via its PolicyCache; a chaos parity test spawns both engines and
asserts identical (verdict, layer, reason_code, policy_version) on 500 random requests.
Decision signals v2
Decision carries metadata-only signals (SIGNALS_SCHEMA_VERSION = 2) so the control plane can
measure outcomes without ever seeing argument values: sink_class (egress / destructive /
credential / financial …), tainted + taint_sources (origin tags such as mcp:jira, web),
secret_in_args, context_tainted, and latency_us. decision_signals(d) returns exactly that
allowlisted dict.
Tool-result inspection
inspect_result(value) looks at what a tool returned, reduces it to a closed set of flags and
never raises. The flags are instruction (text addressed to the model), hidden_unicode
(zero-width, bidi or tag characters), secret (known credential patterns, with no entropy
guessing), pii (a valid SSN, a Luhn-valid card number, or 5 or more distinct emails) and
truncated (over the 256 KiB scan budget).
It is observational: it never changes the verdict of the call that produced the result.
- SDKs and the MCP gateway report a call that ran once, after it finishes. The event carries
result_flagsandresult_bytes, so each call is still one event. - Later calls in the same session carry
context_flags, meaning what the session had already ingested. - A steering result (
instructionorhidden_unicode) taints the session even if the tool was not declared a source. - A
secretresult taints the session too: beyond verbatim containment (a verbatim copy at an egress arg still hard-BLOCKs via secret-egress), the session is context-tainted so a paraphrased / reformatted copy of the credential is stepped-up at the next sink (Rule 2b). Context taint gates sinks only, so reads are unaffected. This is enforced identically in the Python/TS SDKs and the MCP gateway. - A
truncatedresult also taints the session: content beyond the 256 KiB scan budget is not inspected, so the next sink requires approval instead of letting padding become a bypass. - Registered secrets are encoding-resistant. Broker-minted secrets (
Engine.secret()) and secrets registered throughPolicy.register_secret()are matched in egress args after common one-step transforms: base64 / URL-safe base64 (with or without padding), hex, percent-encoding and reversed strings. Split/chunked secrets are still out of scope.
Enforcement contract and known blind spots
What each flag does to enforcement is a deliberate, tested contract:
| flag | effect on later calls |
|---|---|
instruction, hidden_unicode |
taint the session → next sink STEP_UPs (Rule 2b) |
secret |
taint the session (paraphrase STEP_UP) and verbatim egress hard-BLOCKs |
pii |
evidence only — recorded on the event, does not taint (precision: PII heuristics are lower-confidence; gate bulk-PII egress with explicit policy) |
truncated |
taint the session → next sink STEP_UPs, because flags are partial |
Documented, accepted blind spots (consistent across all three languages; closing any is a deliberate,
monitor-mode-first change, not a silent fix): content past the 256 KiB budget is not scanned for the
secret/instruction flags (the session is context-tainted and the taint tracker still retains
head+tail); encoded-secret matching covers common whole-secret transforms but not split/chunked
secrets; instruction patterns match on ASCII word boundaries, so a non-ASCII tool name in the injected text is not flagged; and PII
delivered as JSON numbers (a bare card/SSN integer) is not detected, since results are full of
numeric ids and scanning them would be a false-positive magnet.
Content never leaves the process. The Python, Go and TypeScript implementations are pinned to
result_golden.json, which scripts/gen_result_golden.py generates. Every pattern is bounded, so
hostile input scans in linear time.
strict_ingress=Trueis the default (anti-laundering): verbatim re-wrapping of tainted data as "trusted" keeps its taint. Opt out withEngine(..., strict_ingress=False).- Balanced proven-taint mode (opt-in, Python engine only): with
Policy(untrusted_content_stepup=True), untrusted data that reaches only content args (body, amount, subject…) returnsSTEP_UP(UNTRUSTED_CONTENT_STEPUP) instead ofBLOCK. Untrusted data in a destination arg (Policy.destination_args: recipient, url, iban, channel, user…) still blocks unless the value is inPolicy.known_destinations, or is a URL to an allowlisted host. Unlabeled args, secret egress and high risk (≥ 0.75) stillBLOCK. Default is strict. - Rule 2b — context taint: a sensitive sink reached while the caller reports a tainted context
returns
STEP_UP(CONTEXT_TAINT_STEPUP) unless the tool is inPolicy.context_taint_exempt. It never weakens a verdict: proven value taint still returnsBLOCK, and high probabilistic risk (≥ 0.75) falls through to the Rule 5BLOCK. Only a read-stylehttp_fetchto an allowlisted host is exempt — write egress (http_post,send_email) steps up even to allowlisted hosts, because posting private data to a trusted host (public issue / PR) is the canonical trifecta exfil.
License, security & contributing
- License: Apache-2.0 — free to use, embed, and extend.
- Security: found a way past the guarantee? That's exactly what we want — see
../SECURITY.mdfor coordinated disclosure. - Contributing:
../CONTRIBUTING.md. Rule #1: the guarantee stays deterministic — detectors may only escalate, never downgrade a BLOCK/STEP_UP.
Metadata
Release files for xtrom-engine 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xtrom_engine-0.3.1.tar.gz | 268.8 kB | Without provenance | Details for xtrom_engine-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xtrom_engine-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for xtrom_engine-0.3.1-py3-none-any.whl |
Total release size: 342.2 kB
Release files / xtrom_engine-0.3.1.tar.gz
| Download URL | xtrom_engine-0.3.1.tar.gz |
|---|---|
| Size | 268.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e483e7efb877b8661dc8bde0628645f5154b386e9ada93e6c0f9bfee3ed4f4b
|
|
BLAKE2b-256 checksum How to use checksums |
2be3ca84e9a3dfd40dcc6b51f13d53f7512946fa724dd230d25aa01db30ed643
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Release files / xtrom_engine-0.3.1-py3-none-any.whl
| Download URL | xtrom_engine-0.3.1-py3-none-any.whl |
|---|---|
| Size | 73.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
31b56268e006cce717c834980ea58117a474374987d6845932425efab1955640
|
|
BLAKE2b-256 checksum How to use checksums |
ccfccdc0f0fde93058a06f84bb08b140109980e5f3f16e2d9a78a9e8cbde2834
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Security for xtrom-engine 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.