GitHub - Rehanrana11/evidence-verify: Verify AI audit logs: chain integrity, tamper detection, and the independence check most vendors fail. EU AI Act Article 12. · GitHub
/" data-turbo-transient="true" />
Skip to content
Type / to search
Sign in<br>Sign upAppearance settings
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
Rehanrana11
evidence-verify
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star
main
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>5 Commits<br>5 Commits
LICENSE
LICENSE
README.md
README.md
battery-forge-meta-prompt.md
battery-forge-meta-prompt.md
battery.py
battery.py
demo_anchor.json
demo_anchor.json
evidence_verify.py
evidence_verify.py
make_samples.py
make_samples.py
sample_anchored.jsonl
sample_anchored.jsonl
sample_selfattested.jsonl
sample_selfattested.jsonl
sample_tampered.jsonl
sample_tampered.jsonl
View all files
Repository files navigation
evidence verify
One command that answers the question your AI audit logs can't:<br>who guarantees this log wasn't altered by the system that produced it?
$ evidence verify receipts.jsonl
entries checked : 5<br>chain verdict : CHAIN VALID<br>independence : SELF-ATTESTED — would not survive independence challenge.<br>Every hash in this chain was produced and stored by the same<br>system it describes; a compromised producer can re-sign the<br>entire chain. No external anchor found.
Why this exists
The EU AI Act's Article 12 requires automatic event logging for high-risk AI<br>systems (Annex III obligations now apply from December 2, 2027 under the July 2026 Omnibus amendment; retention ≥6 months under Articles<br>19/26(6)). Most vendors answer with hash-chained logs.
A hash chain proves sequence . It does not prove independence . If the<br>system that writes the log is compromised — or simply motivated — it can<br>rewrite history and re-sign the entire chain. The log is a diary, not an<br>affidavit. The enforcer cannot be the notary.
evidence verify checks three levels:
CHAIN — is every entry linked to the previous one?
TAMPER — does every entry's content still match its hash?
INDEPENDENCE — does the chain reference an anchor outside the<br>producing system? If not, it says so, plainly.
It works on any log that follows the receipt format below — including logs<br>from other gateways and proxies. Point it at your current vendor's export and<br>see what an auditor would see.
Install
Go 1.21+:
go build -o evidence .<br>./evidence verify sample_selfattested.jsonl
Python reference implementation (identical logic, used for cross-testing):
python3 evidence_verify.py sample_selfattested.jsonl
Exit codes
0 = chain valid and anchored (round-trip verified when --anchor is given). 1 = self-attested, mismatch, or broken/tampered.<br>2 = usage or file error. CI can gate on 0.
Receipt format (v0.1 — spec RFC coming)
One JSON object per line (JSONL):
",<br>"entry_hash": "",<br>"anchor": { "type": "external", "provider": "...", "ref": "..." }<br>}">{<br>"seq": 1,<br>"ts": "2026-08-09T10:01:00Z",<br>"event": { "model": "...", "request_sha256": "...", "response_sha256": "...", "decision": "allow" },<br>"prev_hash": "",<br>"entry_hash": "",<br>"anchor": { "type": "external", "provider": "...", "ref": "..." }
canonical(event) = JSON with sorted keys, no whitespace (RFC 8785-style).<br>The Go and Python implementations are byte-compatible.
v0.2: anchor round-trip
Anchor a chain (store the output OUTSIDE the producing system — a separate<br>repo, a gist, S3, a timestamping service):
anchor.json">python evidence_verify.py anchor receipts.jsonl > anchor.json
Verify against the anchor (local file or https URL):
python evidence_verify.py verify receipts.jsonl --anchor anchor.json<br>python evidence_verify.py verify receipts.jsonl --anchor https://example.com/anchor.json
Round-trip verification catches what hash chains alone cannot: full history<br>rewrites (re-signed chains) and truncation. The independence guarantee is<br>exactly as strong as the independence of where the anchor lives.
Samples
sample_selfattested.jsonl — valid chain, no anchor (what most vendors ship)
sample_anchored.jsonl — valid chain with external anchor references
sample_tampered.jsonl — one entry silently edited; the verifier catches it
Regenerate with python3 make_samples.py.
Roadmap
Ed25519 signature verification (asymmetric, third-party verifiable)
eIDAS-compatible qualified timestamp validation for anchors
Adapters: Kong plugin export, LangChain callback, LiteLLM, OpenAI<br>compliance-log export (which retains ~30 days by default — mind the<br>6-month retention gap)
License
Apache-2.0. Verification stays free forever. That's the point.
About<br>Verify AI audit logs: chain integrity, tamper...