oatf
Rust SDK for the Open Agent Threat Format (OATF).
OATF is a YAML-based format for describing security threats against AI agent communication protocols (MCP, A2A, AG-UI). This crate provides parsing, validation, normalization, serialization, and evaluation of OATF documents.
Quick Start
use ;
// Parse → validate → normalize in one step
let result = load.expect;
println!;
// Or use individual entry points
let doc = parse.unwrap;
let validation = validate;
assert!;
let normalized = normalize;
let yaml_out = serialize.unwrap;
Feature Flags
| Feature | Default | Description |
|---|---|---|
cel-validate |
yes | CEL expression syntax validation (V-014) via the cel crate parser. |
cel-eval |
yes | Default CEL expression evaluation via the cel crate. Enables DefaultCelEvaluator. |
To disable all CEL support (reduces dependencies):
[]
= { = "0.4", = false }
To keep CEL syntax validation but provide your own evaluator:
[]
= { = "0.4", = false, = ["cel-validate"] }
Pipeline
parse(yaml) → Document → validate(doc) → ValidationResult
→ normalize(doc) → Document → serialize(doc) → yaml
- parse — YAML →
Document. Rejects anchors, aliases, merge keys, multi-document streams. - validate — 50 conformance rules (V-001–V-050) returning all errors and warnings.
- normalize — 8 idempotent steps converting to canonical multi-actor form.
- serialize —
Document→ YAML. - load — Convenience: parse → validate → normalize.
- evaluate — Pattern, CEL expression, and semantic indicator evaluation with verdict computation.
- primitives — 13 execution primitives (path resolution, duration parsing, condition evaluation, etc.).
Conformance
This crate passes the full OATF conformance suite (442 test cases across parse, validate, normalize, evaluate, verdict, roundtrip, and primitives).
Minimum Supported Rust Version
The MSRV is 1.88.0 (edition 2024). It is tested in CI and will be bumped as a minor version change.