Engineering · TourCheck

A logbook that signs itself

5 November 2026 · Software by Design

A guard-tour log is only worth something in the dispute, the insurance claim, the incident review, the "prove the night round happened." If the database is the only evidence, whoever can edit the database decides what happened. TourCheck's answer is a journal that makes tampering visible instead of impossible.

Write once, chain everything

Every event, a checkpoint scan, a round start, an incident, is written once and never updated. Corrections are new rows, not edits. On top of those rows sits a hash-chained journal: each entry carries a hash that binds it to the previous entry and to the payload of the row it references, the way a blockchain does minus everything that makes a blockchain insufferable. Rewriting history means recomputing every entry after it, and the chain head is stored where a verifier notices.

The point isn't that tampering is impossible; nothing on a self-hosted box is. The point is that tampering leaves fingerprints. Verification recomputes the payload hash of every referenced row: a row that was deliberately erased verifies as TOMBSTONED, intentional, visible, while anything else inconsistent verifies as TAMPERED. "The database says so" becomes "the database can prove it."

The rules that make it hold

A red-team pass turned the vague promise into enforced invariants, and the interesting ones are the boring ones:

  • One writer for round status. A single code path may transition a round's status, inside a transaction, and every transition produces a journal entry naming who closed it. No stray UPDATE in a controller can quietly rewrite an outcome.
  • The server decides provenance. The method and site scope of an event are resolved server-side from binding and membership. The client's claims are inputs to validation, never stored verbatim, so a crafted request can't attribute its scan to a station it doesn't belong to.
  • Replay compares claims, not just ids. A repeated client event id is checked against the stored payload hash, binding note, photo and timestamp, a replay that disagrees with the original is a mismatch, not a dedupe.
  • Probes cost the attacker. Unknown-member attempts burn the station's lockout counter, so probing can't be used to enumerate which members exist without also locking the thing being probed.
  • One lock order, always. Round row first, then chain head, never reversed. It exists so that event ingest and round close cannot deadlock each other; correctness under concurrency is also an integrity property.

Evidence lives where access is a policy

Photos and generated reports don't go into user-visible Files folders, they live in appdata under app-managed ids, with authorization decided by site role. That kills an entire class of bug: the "other viewers get a 404 or, worse, a 200" problem that comes free with file permissions. Day-level anchoring handles the boring case too: an empty chain still produces a valid anchor, so "nothing happened last Tuesday" is itself a provable statement.

None of this requires trusting us. The chain verification is code you can run, the threat model is written down in the decision records, and the AGPL means a works council, an auditor, or a skeptical admin can check that the logbook does what this post says. Signature features that can't be inspected aren't signatures, they're decorations.