{
  "id": 9747402,
  "title": "I built a tiny library that makes your audit logs tamper-evident",
  "url": "https://urgent.news/2026/09/25/i-built-a-tiny-library-that-makes-your-audit-logs-tamper-evident",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-25T10:12:01.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/wfx1607/i-built-a-tiny-library-that-makes-your-audit-logs-tamper-evident-1eeo"
  },
  "original_language": "en",
  "account": "Most applications maintain audit logs that record user actions, timestamps, and modifications. Unfortunately, these logs can be easily tampered with by malicious insiders, attackers, or even honest bugs. This creates a serious problem for systems that rely on audit logs as evidence for compliance, security investigations, or billing disputes. If someone later claims that a record has been altered, there is no way to prove otherwise. The author encountered this issue repeatedly, and found that the common solution involved manually implementing a hash chain. To address this common problem, the author created a small library called chainlog.\n\nchainlog takes an existing audit log and makes it tamper-evident. Each log entry contains a SHA-256 hash that includes the entry's content, an index, the timestamp, and the hash of the previous entry. This creates a chain of entries where altering any past entry will cause subsequent hashes to no longer match. By calling the verify() function, the entire chain can be verified in a single pass, revealing exactly where the tampering occurred. The library provides various options for storing the audit log, including in-memory, JSONL-file, and SQLite databases.\n\nWhile chainlog does not prevent writes to the log, it can detect if the log has been altered. For stronger guarantees, the head hash of the log should be anchored outside of the log, such as by emailing it, committing it, or timestamping it. This allows any full rewrite of the log to be detected. chainlog is currently implemented in TypeScript, with memory, file, and SQLite storage options available. The author plans to add adapters for other databases like Postgres, MySQL, and MongoDB, as well as Python and PHP ports. The code is open source under the MIT license, encouraging anyone to contribute or use it for their own applications. The GitHub repository can be found at https://github.com/webfixerr/chain-log.",
  "summary": "Most apps keep an audit log — who did what, and when. An admin deleted a user, a payment went through, a permission changed. And most of those logs sit in a database table or a file that anyone with access can silently edit or delete after the fact. A rogue insider, an attacker covering their tracks, even an honest bug — nothing stops a past log line from being quietly rewritten, and nothing lets…",
  "key_points": [
    "Chainlog library makes audit logs tamper-evident",
    "Each entry contains SHA-256 hash and previous hash",
    "Verify() function detects tampering in single pass"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}