mirror of
https://github.com/kuhyx/signal-bot.git
synced 2026-11-24 00:56:18 +01:00
fix: the gate missed a group id quoted half-way
Some checks are pending
CI / check (push) Waiting to run
Some checks are pending
CI / check (push) Waiting to run
A journal line pasted into a commit message stopped at "group.<first few characters>...", 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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017w1HZ3cZ7neL3rFdQ6VMBA
This commit is contained in:
parent
37a27c6dff
commit
86e174ee49
@ -28,6 +28,11 @@ REPO: Final = Path(__file__).resolve().parent.parent
|
|||||||
# popes, which is a cost worth paying to catch a real one.
|
# popes, which is a cost worth paying to catch a real one.
|
||||||
MIN_NAME: Final = 3
|
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]:
|
def _pack_names(directory: Path) -> set[str]:
|
||||||
"""Every trigger word in a photo pack manifest -- i.e. every name."""
|
"""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()
|
inner: set[str] = set()
|
||||||
for group in found:
|
for group in found:
|
||||||
payload = group.removeprefix("group.")
|
payload = group.removeprefix("group.")
|
||||||
|
# The leading run as well as the whole id: a log line quoted into a
|
||||||
|
# commit message says "group.<first few chars>..." and stops, and
|
||||||
|
# matching only the full id let exactly that through once.
|
||||||
|
inner.add(payload[:PREFIX])
|
||||||
try:
|
try:
|
||||||
inner.add(base64.b64decode(payload, validate=True).decode("utf-8"))
|
inner.add(base64.b64decode(payload, validate=True).decode("utf-8"))
|
||||||
except ValueError, UnicodeDecodeError:
|
except ValueError, UnicodeDecodeError:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user