Architecture
Architecture AI-ChainGuard. 4 min read. Source on GitHub . Passes the style check .
Print
Opens at full size in a new tab. The provenance chain as the console draws it.
One core library (chainguard/) holds all security logic. The CLI, FastAPI backend, ML pipeline, deployment gateway, attack scripts, and CI call that same library, so there's exactly one implementation of hashing, signing and verification. The dashboard uses only the HTTP API.
1. Overall System Architecture#
crypto/signing + keys Ed25519
manifest/ models + builder
verification/verifier V0-V9
artifacts/manifests signed envelopes
Enlarge Figure 1. Overall system architecture.
2. AI Supply-Chain Lifecycle with Attestation Points#
Data collection sklearn digits
Stage 1 datasets attested data_steward
Stage 2 base model trained training_pipeline
Stage 3 fine-tuned model training_pipeline
Stage 4 deployment gateway
Signed deployment record release root
Blocked DEPLOYMENT_BLOCKED event
Enlarge Figure 2. AI supply-chain lifecycle with attestation points.
3. Artifact Attestation Sequence#
Envelope files + SQLite Trust store + Ed25519 Semantic checks Hashing + Merkle Verifier Registry loop [each parent] Caller (pipeline / CLI / API) register(file, type, stage, role, parents) verify(parent) - refuse if FAILED read parent payload, compute manifest digest policy check (type, stage, role, parent types) load role key, check it matches trusted key id SHA-256 (streamed) [+ row Merkle tree for CSV] content checks (datasets) BEFORE signing build payload (subject, parents' digests, provenance, checks, signer) sign canonical_json(payload) write envelope + leaves sidecar, index row, event, metrics artifact_id, manifest_digest Enlarge Figure 3. Artifact attestation sequence.
4. Verification Sequence#
SQLite (trust store, revocation) Files Verifier Gateway / API / CI verify(artifact_id) V0 load envelope (raw JSON, schema, id matches) V1 recompute SHA-256 + size V2 recompute row Merkle root, diff via authenticated sidecar V3/V4 public key, revocation, role, identity V3 Ed25519 verify over canonical payload V5 load parents, recompute their manifest digests V6 recurse into every parent (memoised) V7 revocation of artifact + ancestors, index row exists V8 policy, V9 semantic flags (own + inherited) store run, status, metrics, events VERIFIED / WARNING / FAILED + per-check report Enlarge Figure 4. Verification sequence.
5. Attack-Detection Workflow#
V1/V2 bytes and rows match signed values?
FAILED: content tampered Scenarios A, B, E1
V3/V4 valid signature by trusted key in role?
FAILED: invalid or untrusted signature Scenario D
V5/V6 parents exist, digests match, ancestors pass?
FAILED: broken provenance Scenario C
V7 revoked anywhere in the chain?
FAILED: policy violation C4
V9 content flagged here or upstream?
WARNING: integrity intact, content suspicious - E3
VERIFIED - still not proof of safety E2, E4
Enlarge Figure 5. Attack-detection workflow.
6. Deployment View#
Enlarge Figure 6. Deployment view.
7. Key Design Decisions#
Decision
Alternatives
Reason
Envelopes on disk are the source of truth; SQLite is an index
DB as truth
CI and auditors can verify from files; DB tampering can't fake integrity
Sign the whole canonical payload
Sign only the file hash
Prevents swapping stage, parents, version, role around a valid hash
Parents referenced by manifest digest
By artifact id only
Hash-linking makes history rewrites detectable (C2)
Recursive verification at every use
Trust a parent's stored status
Stored status can be edited; recomputation costs a few ms
Semantic flags → WARNING only
Fail on any flag
Keeps heuristics from being mistaken for cryptographic proof
Role-bound keys + YAML policy
One signing key
Limits blast radius of one key compromise