<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/anyone-with-database-access-can-rewrite-your-ai-agent-s-logs-aaouowjyq" -->

---
title: Anyone with database access can rewrite your AI agent's logs
description: A tamper-evidence design for AI agent logs is explained through the open-source project NoireBox: append-only databases and hash chains are not enough because...
canonical: https://daily.dev/posts/anyone-with-database-access-can-rewrite-your-ai-agent-s-logs-aaouowjyq
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Anyone with database access can rewrite your AI agent's logs | daily.dev
og:description: A tamper-evidence design for AI agent logs is explained through the open-source project NoireBox: append-only databases and hash chains are not enough because...
og:url: https://daily.dev/posts/anyone-with-database-access-can-rewrite-your-ai-agent-s-logs-aaouowjyq
og:image: https://api.daily.dev/og/posts/AAouowJYQ.png
og:image:alt: Anyone with database access can rewrite your AI agent's logs
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Anyone with database access can rewrite your AI agent's logs

**[Sam LABBE](https://daily.dev/sources/iqt7ahbrsnrmjmpeny6ak)** · [@slabb](https://daily.dev/slabb) · 6 min read · 0 upvotes · 0 comments

## Summary

A tamper-evidence design for AI agent logs is explained through the open-source project NoireBox: append-only databases and hash chains are not enough because an operator holding the signing key can regenerate an entire fake but internally consistent chain. The fix is external anchoring via RFC 3161 timestamp authorities, eIDAS qualified timestamps, or OpenTimestamps (Bitcoin), so a witness outside the operator's control attests to when a hash existed. A Merkle tree over per-agent chain heads lets one anchor cover many journals, only a 32-byte digest ever leaves the infrastructure (GDPR-friendly), and an auditor can verify integrity offline with a JSON export and a standalone script. The EU AI Act mandates automatic event logging for high-risk systems from December 2027, and the design targets that requirement while being explicit that it proves integrity, not that the recorded events are honest.

## Content

Your AI agent already logs everything. Prompts, tool calls, outputs, all

neatly in a table. The problem isn't capturing the data. It's that on the day

somebody important asks "prove this is exactly what the agent produced", your

logs are a confession written about yourself, in a database you control, with

no way to show they were never touched.

I ran into this while building NoireBox, an open-source flight data recorder

for AI agents. This post is the part I'd want to read even if I never touched

that project: what it actually takes to make an agent journal tamper-evident,

and the one attack that breaks the obvious solution.

## Append-only is not tamper-evidence

First instinct: make the log append-only. No UPDATE, no DELETE. Better than

nothing, and it stops the sloppy mistakes.

It stops nothing else. The database admin can edit rows. The server can be

compromised. The application itself, the thing writing the log, can be pointed

at a different file. An append-only flag is a promise made by the same system

you are trying to hold accountable.

The standard fix is old, boring, and it works: a hash chain. Each record

carries the hash of the previous one:

h*n = SHA-256(h*{n-1} || payload*n || metadata*n)

Edit one row and every hash after it breaks. Sign each new head with Ed25519

and you also know which key was signing at which point. The whole mechanism is

two small files you can read in one sitting: 168 lines for the SHA-256 chain

and Ed25519 signatures, 130 for the append-only SQLite store with BEGIN

IMMEDIATE so two processes can't silently interleave writes.

So: done? Not even close.

## The attack that breaks the obvious solution

Here's the problem I had to design against, and that almost every "blockchain

for logs" pitch quietly skips.

The private key lives on your infrastructure. The operator holds it. An

operator who wants a fake history doesn't need to break any crypto. They

regenerate the whole chain: write the fabricated events, recompute every hash,

re-sign everything, replay the timestamps. The result is an internally

consistent journal, every signature valid, every link intact. Verification

against its own key passes with flying colors.

A chain that verifies against itself proves only that somebody with the key

built it. It cannot tell you _when_. And "when" is the whole game: a seal

created after the fact proves nothing about the state that existed before it.

You need a witness that sits outside the operator's control and saw the hash

value at a point in time.

## Anchoring: timestamps from someone with something to lose

RFC 3161 timestamp authorities do exactly this. You send them a hash, they

sign hash plus time with their own key, and now forging your history means

forging their signature too. Two tiers matter in Europe:

- **Public TSAs** (DigiCert, FreeTSA) are free and immediate. The detail that

makes them trustworthy is where the trust anchors live: the verifier checks

against TSA root certificates pinned in its own repository, never against a

certificate the operator ships with the export. If the operator could choose

the roots, we'd be back to square one.

- **eIDAS qualified timestamps** carry a legal presumption in the EU (art. 41):

date and integrity are presumed correct until someone challenges them. For

AI Act documentation this is the difference between "technical measure" and

"measure a lawyer accepts".

And then there's the strange one: OpenTimestamps. Your hash gets aggregated

into a Merkle tree that lands in a Bitcoin block. Forging the receipt means

redoing the network's proof of work. Verifying takes microseconds of SHA-256

and it stays valid as long as Bitcoin exists. Zero trust in any organization.

One detail makes all of this GDPR-friendly: only the 32-byte chain head ever

leaves your infrastructure. No payload, no names, no transcript content. The

anchor is a timestamp over an opaque number.

## The retroactivity trick

A natural objection: "fine, I start anchoring today, but my chain already has

six months of history. Who says those events weren't written yesterday?"

They don't need to have been anchored back then. The chain head is a digest of

the entire past, so anchoring _today_ seals everything before today. A

regenerated fake chain produces a different head, and the head recorded in the

TSA receipt doesn't match it. Caught at verification time, no matter when the

tampering happened.

Anchor on a schedule and the falsifiable window shrinks to the tail since the

last anchor.

## Many boxes, one seal

The CT-inspired part: when every agent gets its own journal (one journal per

service, like one flight recorder per aircraft), you don't send every journal

to the TSA. You build a Merkle tree over the 32-byte chain heads and anchor

the root. One seal covers N journals, and an inclusion proof for any single

journal is about log2(N) hashes, verifiable offline against the signed root.

Your journals never leave your infrastructure. Only heads do.

## What an auditor actually takes

The export that convinced me this design was right is almost anticlimactic:

one JSON file plus a standalone verifier script. The auditor runs the

verifier, gets exit 0, and the same folder includes the logging description

that AI Act Annexe IV §2(f) asks for. There is also a GitHub Action that gates

a build on journal integrity, so a pipeline consuming an agent's output can

refuse to build when the chain is broken.

Two honest limits, because overselling compliance is how tools become

liabilities. First, this proves integrity, nothing else: payload minimization

and HSM-grade key storage stay your problem. Second, a journal proves what was

recorded, not that the recorder is honest about the world. A guardrail that

journals "incident detected" proves the detection was recorded, not that

detection works.

Which I learned the hard way in a different form: I once wrote a security

baseline document with the finding counts before actually running the scanner.

The numbers were plausible, formatted, and fiction. The corrected version was

produced by running the tool and pasting the reproduction command next to the

results. That distinction, plausible narrative versus reproducible receipt, is

the entire thesis of the tool.

## Try it in two minutes

pip install noirebox # MIT, Python 3.11+, no cloud

noirebox serve # API + OpenAPI docs on 127.0.0.1:8768

curl -s localhost:8768/api/v1/export > export.json

python verifier/verifier.py export.json # exit 0 = chain intact (script ships in the repo)

There's also a Docker image (ghcr.io/slabbdev/noirebox) and a demo where

tampering with a single event visibly explodes the chain.

The EU AI Act makes automatic event logging mandatory for high-risk systems

from December 2027. Most stacks will check that box with a database table. The

interesting question for the next two years is who can also prove their logs

mean something.

Repo: [https://github.com/slabbdev/noirebox](https://github.com/slabbdev/noirebox)

If you've been through an audit of an AI system, I'm curious what your logs

actually looked like.

## Similar posts on daily.dev

- [The Witness Was the Suspect: Why AI Audit Logs Can't Be Trusted](https://daily.dev/posts/the-witness-was-the-suspect-why-ai-audit-logs-can-t-be-trusted-qkcmhguoy) · DEV · 9 upvotes · 1 comments
- [What your logs can’t tell you when an AI agent acts alone](https://daily.dev/posts/what-your-logs-can-t-tell-you-when-an-ai-agent-acts-alone-mu2wtboeu) · The New Stack · 1 upvotes · 0 comments
- [Solving EU AI Act Article 12 Compliance: How We Built Continuous Evidence Generation for AI Agents](https://daily.dev/posts/solving-eu-ai-act-article-12-compliance-how-we-built-continuous-evidence-generation-for-ai-agents-aqgyyi879) · Medium · 1 upvotes · 0 comments
- [Trust in Protocols, Not Institutions: Transparency Logs for API Authorization](https://daily.dev/posts/trust-in-protocols-not-institutions-transparency-logs-for-api-authorization-om2jhvkww) · API Evangelist · 0 upvotes · 0 comments
- [Why every AI agent decision needs a receipt](https://daily.dev/posts/why-every-ai-agent-decision-needs-a-receipt-toqfrephk) · The New Stack · 1 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents)

[View this post on daily.dev](https://daily.dev/posts/anyone-with-database-access-can-rewrite-your-ai-agent-s-logs-aaouowjyq)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/anyone-with-database-access-can-rewrite-your-ai-agent-s-logs-aaouowjyq","headline":"Anyone with database access can rewrite your AI agent's logs","text":"A tamper-evidence design for AI agent logs is explained through the open-source project NoireBox: append-only databases and hash chains are not enough because an operator holding the signing key can regenerate an entire fake but internally consistent chain. The fix is external anchoring via RFC 3161 timestamp authorities, eIDAS qualified timestamps, or OpenTimestamps (Bitcoin), so a witness outside the operator's control attests to when a hash existed. A Merkle tree over per-agent chain heads lets one anchor cover many journals, only a 32-byte digest ever leaves the infrastructure (GDPR-friendly), and an auditor can verify integrity offline with a JSON export and a standalone script. The EU AI Act mandates automatic event logging for high-risk systems from December 2027, and the design targets that requirement while being explicit that it proves integrity, not that the recorded events are honest.","url":"https://daily.dev/posts/anyone-with-database-access-can-rewrite-your-ai-agent-s-logs-aaouowjyq","datePublished":"2026-09-26T22:30:24.582Z","dateModified":"2026-09-26T22:30:49.696Z","author":{"@type":"Person","name":"Sam LABBE","url":"https://daily.dev/slabb","image":"https://media.daily.dev/image/upload/s--4py3ZbO9--/f_auto/v1791845430/avatars/avatar_iqt7ahbrSNRmJmpeNy6AK?_a=BAMAMicg0","description":"Building NoireBox — the flight recorder for your AI agent","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":150}},"image":"https://media.daily.dev/image/upload/s--xhJ82dUa--/f_auto/v1790461824/posts/AAouowJYQ?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/iqt7ahbrsnrmjmpeny6ak","name":"Sam LABBE"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Sam LABBE","item":"https://daily.dev/sources/iqt7ahbrsnrmjmpeny6ak"},{"@type":"ListItem","position":3,"name":"Anyone with database access can rewrite your AI agent's logs"}]}
```

