Przeglądaj źródła

docs: a clean snapshot result is weaker than this repo claimed, and my reason was wrong

The database owner corrected a claim of mine twice over today, and the
second correction changes what an absence is worth in a security check I
wrote.

I had recorded that these files "are NOT compressed - gzip still halves
them", inferring non-compression from gzip shrinking them further. That
inference was wrong: the snapshot writer compresses with LZ4 whenever
compression is on, which is the default, and gzip shrinking an LZ4 file is
expected rather than evidence. My practical conclusion survived - strings
-a really does surface plaintext - but for a different reason: LZ4 output
is mostly literal runs, so plaintext survives in fragments.

That makes the check ASYMMETRIC on a snapshot, and only one direction
counts: a HIT is real evidence, a MISS is not. A long token - an API key,
a 28-character document id - can be split across a match reference, so
strings never shows it whole and the absence means "not in the literal
runs" rather than "not there".

So audit-backup-credentials.sh is weaker than its own header claimed, in
the direction I least expected. Its EXPOSED verdicts rest on hits and are
sound; any clean verdict over a SNAPSHOT bounds what is findable in the
literal runs, not what is present. Corrected in the script's header as well
as in CLAUDE.md, because the header is what someone running it reads. The
positive control stays load-bearing - without it the check cannot report at
all - it simply does not upgrade a snapshot miss into an absence, which is
why the verdicts were three values rather than a boolean.

Prefer a WAL segment or an LMDB file when an absence has to carry weight;
neither is written through the compressing path.
fszontagh 1 miesiąc temu
rodzic
commit
27bd9d4899
2 zmienionych plików z 25 dodań i 3 usunięć
  1. 0 0
      CLAUDE.md
  2. 25 3
      scripts/audit-backup-credentials.sh

Plik diff jest za duży
+ 0 - 0
CLAUDE.md


+ 25 - 3
scripts/audit-backup-credentials.sh

@@ -7,9 +7,31 @@
 # EVERYTHING - including strings that are certainly present. Measured
 # 2026-10-19: `grep -c -F novitax` answered 0 on a WAL segment where
 # `strings -a | grep -c -F novitax` answered 5957, because the files carry
-# custom framing (CALWAL01 / CALSNAP1) with embedded NULs. They are not
-# compressed; gzip still halves them. So the text is right there and grep
-# will not surface it.
+# custom framing (CALWAL01 / CALSNAP1) with embedded NULs, so grep will not
+# surface text past them.
+#
+# WHY A CLEAN RESULT ON A *SNAPSHOT* IS WEAKER THAN THIS SCRIPT ORIGINALLY
+# CLAIMED. The header used to say the files "are not compressed; gzip still
+# halves them". That inference was wrong: the database owner confirmed
+# 2026-10-22 that the snapshot writer compresses with LZ4 whenever
+# `compression` is on, which is the DEFAULT, and gzip shrinking an LZ4 file
+# further is expected rather than evidence of anything. `strings -a` still
+# surfaces plaintext there, but for a different reason - LZ4 output is mostly
+# literal runs, so plaintext survives in FRAGMENTS.
+#
+# The consequence is an ASYMMETRY, and only one direction counts on a
+# snapshot: a HIT is real evidence of exposure, a MISS is NOT evidence of
+# safety. A long token - an API key, a 28-character document id - can be
+# split across an LZ4 match reference, so it is never shown whole and the
+# absence means "not found in the literal runs" rather than "not there".
+# So read a clean SNAPSHOT verdict as "nothing surfaced", never as "nothing
+# is there", and prefer a WAL segment or an LMDB file when an absence has to
+# carry weight - those are not written through the compressing path.
+#
+# The positive control below is still load-bearing: without it the check
+# cannot report at all. It simply does not upgrade a snapshot miss into an
+# absence, which is why the verdicts are PRESENT / REVIEW / EXPOSED rather
+# than a boolean.
 #
 # That makes the obvious script a check that CANNOT FAIL: it reports a clean
 # bill of health on a credential audit while being incapable of reporting an

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików