From 86e174ee49dd083abd0837c79e53bfd2100a35be Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sun, 30 Aug 2026 23:36:18 +0200 Subject: [PATCH] fix: the gate missed a group id quoted half-way A journal line pasted into a commit message stopped at "group....", which matched neither the full id nor the decoded one, so the check passed and the id shipped. Eight base64 characters now count as that group: 48 bits, unique enough that a coincidence does not matter, short enough to catch a truncated quotation. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_017w1HZ3cZ7neL3rFdQ6VMBA --- scripts/personal_data_sources.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/personal_data_sources.py b/scripts/personal_data_sources.py index 4fa36da..5a0c9ee 100755 --- a/scripts/personal_data_sources.py +++ b/scripts/personal_data_sources.py @@ -28,6 +28,11 @@ REPO: Final = Path(__file__).resolve().parent.parent # popes, which is a cost worth paying to catch a real one. MIN_NAME: Final = 3 +# How much of a group id has to appear before it counts as that group. Eight +# base64 characters are 48 bits: unique enough that a coincidence is not +# worth worrying about, short enough to catch a truncated quotation. +PREFIX: Final = 8 + def _pack_names(directory: Path) -> set[str]: """Every trigger word in a photo pack manifest -- i.e. every name.""" @@ -104,6 +109,10 @@ def _database_groups(path: Path) -> set[str]: inner: set[str] = set() for group in found: payload = group.removeprefix("group.") + # The leading run as well as the whole id: a log line quoted into a + # commit message says "group...." and stops, and + # matching only the full id let exactly that through once. + inner.add(payload[:PREFIX]) try: inner.add(base64.b64decode(payload, validate=True).decode("utf-8")) except ValueError, UnicodeDecodeError: