<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: FITHRIYAH</title>
    <description>The latest articles on DEV Community by FITHRIYAH (@fithriyah).</description>
    <link>https://dev.to/fithriyah</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4271794%2Ff82dd7da-c624-47ea-b020-acc46f747fdd.jpg</url>
      <title>DEV Community: FITHRIYAH</title>
      <link>https://dev.to/fithriyah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fithriyah"/>
    <language>en</language>
    <item>
      <title>Our Tamper-Evident Log Never Checked a Hash: The LibrarySentry Near Miss</title>
      <dc:creator>FITHRIYAH</dc:creator>
      <pubDate>Sun, 29 Nov 2026 06:30:44 +0000</pubDate>
      <link>https://dev.to/fithriyah/our-tamper-evident-log-never-checked-a-hash-the-librarysentry-near-miss-4l02</link>
      <guid>https://dev.to/fithriyah/our-tamper-evident-log-never-checked-a-hash-the-librarysentry-near-miss-4l02</guid>
      <description>&lt;p&gt;LibrarySentry is our entry to Agentware 2026, the 72-hour Hackathon Raptors agent hackathon, in the Research &amp;amp; Study track: an unattended guard for a learning library that watches feeds, pages, and a local folder, files new finds as Markdown notes, extracts deadlines, and builds a daily reading brief. Python standard library only, deterministic, no LLM in the loop. We set out to enforce every safety property in code rather than in a prompt. This write-up is about the one we claimed to enforce and didn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  The claim that wasn't true
&lt;/h2&gt;

&lt;p&gt;Our README and SAFETY.md described the audit trail as an append-only, hash-chained JSONL log that detects a one-byte change — one of our four safety-bonus features. It wasn't a hash chain. No record carried a hash, and nothing ever computed one.&lt;/p&gt;

&lt;h2&gt;
  
  
  The experiment
&lt;/h2&gt;

&lt;p&gt;Late in the build, while producing the demo, we ran the obvious test: flip one byte inside an event's detail string in a committed trace, and run our verifier on it. It passed. Cleanly.&lt;/p&gt;

&lt;p&gt;The verifier checked valid JSON, continuous sequence numbers, and required keys — nothing more. A one-byte edit to any event's content was invisible.&lt;/p&gt;

&lt;p&gt;"Only a sentence was wrong" understates it: the verifier was a control that failed open, reporting success on a tampered trace. Every committed trace carried an integrity guarantee that did not exist, and nothing in the pre-fix artifacts proves their contents genuine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it happened
&lt;/h2&gt;

&lt;p&gt;The docs described the audit trail as designed; the code implemented less. We stated the intended construction — hash-chained, tamper-evident — as if built; what shipped validated only a trace's shape.&lt;/p&gt;

&lt;p&gt;Our 184 tests exercised the logger's mechanics, but not one asserted that a tampered trace &lt;em&gt;fails&lt;/em&gt; verification. The headline claim had no negative test. That those 184 tests later passed unchanged, against code adding two required fields to every record, is not reassurance; it is the indictment. The suite was green the whole time the claim was false.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix, with its limits stated
&lt;/h2&gt;

&lt;p&gt;Every record now carries &lt;code&gt;prev_hash&lt;/code&gt; and &lt;code&gt;hash&lt;/code&gt;: a SHA-256 over the record's canonical JSON form (the &lt;code&gt;hash&lt;/code&gt; field itself excluded), starting from a genesis link of 64 zero hex digits. Appends derive the chain head from the last record on disk, so reopening continues the chain. The verifier recomputes the whole chain and reports the first failing line with its reason — &lt;code&gt;hash_mismatch&lt;/code&gt;, &lt;code&gt;seq_gap&lt;/code&gt;, &lt;code&gt;prev_link_mismatch&lt;/code&gt;, &lt;code&gt;missing_field&lt;/code&gt;, &lt;code&gt;not_json&lt;/code&gt;. Eight new tests cover this: two for the chain itself (genesis linkage; continuity across a reopen) and six tamper cases — a flipped detail byte, a flipped sequence digit, a deleted middle line, reordered lines, a mid-line truncation, a removed hash field. The suite stands at 192 tests. Re-running the original experiment on a 271-event trace, the verifier now fails at line 10: &lt;code&gt;hash_mismatch&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The chain catches edits, deletions, reordering, and truncation by someone who does not recompute downstream hashes. It does not stop a writer who truncates the tail or recomputes the chain after an edit — our retro-chaining script below does exactly that to a whole file. Closing that hole needs an external anchor — a published head hash or a signature — which we did not build.&lt;/p&gt;

&lt;h2&gt;
  
  
  The traces that predated the fix
&lt;/h2&gt;

&lt;p&gt;Fifteen traces were already committed. Three were regenerated by their own generators. Twelve could not be — including the first Trap Pack run's trace, whose pipeline had changed and whose re-run would have replaced its scored record with better numbers. For those twelve, a retro-chaining script adds only the two chain fields, proving line by line that stripping them back out reproduces the original line byte for byte — and aborting if any line fails.&lt;/p&gt;

&lt;p&gt;The limit: that proves the conversion changed nothing, not that the twelve were untouched &lt;em&gt;before&lt;/em&gt; conversion. For that, the only anchor is git history, where the pre-chain originals remain.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Trap Pack, briefly
&lt;/h2&gt;

&lt;p&gt;Separately — and earlier, since the first Trap Pack run predates the discovery above — we ran the 20-file pack and committed the first score, 6 pass, 13 partial, 1 fail, before fixing anything. After fixes, the final run (129-event trace) classifies the pack as 8 quarantined, 4 sanitized, 3 archived, 5 handled-malformed, scoring 16 pass, 4 partial, 0 fail. The four partials: a quarantined item's visible content is isolated with its hostile layer, not filed clean; conflicting deadlines in one document are extracted but the conflict is not flagged; price arithmetic in HTML tables is not validated; and one mislabelled-encoding bill is stopped at the watcher before its arithmetic can be checked. One caveat matters more than the score: we tuned against this same fixed pack, so 16/4/0 measures fixing known failures, not handling unseen hostile content. We have no held-out set.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we would do differently
&lt;/h2&gt;

&lt;p&gt;Test the claim, not the feature. Every SAFETY.md sentence should map to a test first shown failing against a deliberately broken implementation — a tamper test that has never failed proves nothing. Treat green suites with suspicion: adding two required fields to every record broke none of our 184 tests, and relief was the wrong reaction. And score yourself before you fix yourself: committing 6/13/1 before touching the classifier is what makes 16/4/0 believable — to us most of all.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repo: &lt;a href="https://github.com/fithriyah9/librarysentry" rel="noopener noreferrer"&gt;https://github.com/fithriyah9/librarysentry&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Demo (one full unattended run): &lt;a href="https://youtu.be/gzfP82uaxKI" rel="noopener noreferrer"&gt;https://youtu.be/gzfP82uaxKI&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;The Near Miss category's prizes are sponsored by &lt;a href="https://fileclerk.co.uk/" rel="noopener noreferrer"&gt;FileClerk&lt;/a&gt; — thank you to FileClerk for backing the part of this event that rewards honest post-mortems.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>hackathon</category>
      <category>ai</category>
      <category>agents</category>
      <category>security</category>
    </item>
  </channel>
</rss>
