Repository navigation
Conversation
Content-signed detection of world-readable copies of the real HPlan inventory (table belegung with a filled uebungsleiter column), in three tiers: structured SQLite proof, raw-byte markers for NUL-bearing blobs such as WAL images, and SQL text dumps. Scans /tmp, home, repo root, the ~/.treehouse pool, and the service's Docker volume on the server over a bounded ssh read-only sweep; backup folders are excluded. Reports only path, mode, size, tier, and row counts - never content. Repairs nothing. Every failure mode lands as a named partial state while the run exits 0 inside a hard budget cut to the watcher's check timeout, so the supervision cycle survives even a fully failing sweep. Per-path suppression keeps an unchanged fleet silent; arm/disarm follow the trusted-check-shim pattern.
Confidence Score: 2/5The PR does not yet appear safe to merge because three previously reported suppression-state failures remain in the current implementation. Invalid configuration can replace an unloaded ledger, mutable finding metadata changes suppression identities during ordinary database updates, and concurrent checks can overwrite each other's entries; together these behaviors cause repeated alerts and loss of persisted suppression state. Files Needing Attention: bin/fm-hplan-guard.sh Reviews (2): Last reviewed commit: "fix(bin): guard server leg drops size fl..." | Re-trigger Greptile |
| if ! resolve_config; then | ||
| # A bad configuration is a named partial state like any other: reported | ||
| # once through the same suppression ledger, never a crash. | ||
| PARTIALS+=("falsch konfiguriert: $CONFIG_ERROR") | ||
| emit_suppressed_or_line | ||
| return 0 | ||
| fi |
There was a problem hiding this comment.
Configuration failure discards suppression state
When any HPLAN_GUARD_* setting is invalid, this branch emits and writes suppression state before record_read loads the existing ledger, causing the configuration alert to repeat every cycle and previously suppressed leak findings to be reported again after configuration is repaired.
| if ! resolve_config; then | |
| # A bad configuration is a named partial state like any other: reported | |
| # once through the same suppression ledger, never a crash. | |
| PARTIALS+=("falsch konfiguriert: $CONFIG_ERROR") | |
| emit_suppressed_or_line | |
| return 0 | |
| fi | |
| if ! resolve_config; then | |
| # A bad configuration is a named partial state like any other: reported | |
| # once through the same suppression ledger, never a crash. | |
| record_read | |
| PARTIALS+=("falsch konfiguriert: $CONFIG_ERROR") | |
| emit_suppressed_or_line | |
| return 0 | |
| fi |
| record_write() { # <keys-reported-space-list>: persist the ledger atomically | ||
| local reported=$1 now cutoff keep='' tmp | ||
| local entry ekey eepoch key found i | ||
| mkdir -p "$STATE" 2>/dev/null || true | ||
| now=$(real_epoch) | ||
| cutoff=$((now - 604800)) | ||
| local -a ks=() | ||
| local -a es=() | ||
| local IFS=';' | ||
| for entry in $REC_SEEN; do | ||
| [ -n "$entry" ] || continue | ||
| ekey=${entry%%:*} | ||
| eepoch=${entry##*:} | ||
| case "$eepoch" in ''|*[!0-9]*) continue ;; esac | ||
| [ "$eepoch" -ge "$cutoff" ] || continue | ||
| ks+=("$ekey") | ||
| es+=("$eepoch") | ||
| done | ||
| unset IFS | ||
| for key in $reported; do | ||
| found=0 | ||
| for i in ${ks[@]+"${!ks[@]}"}; do | ||
| [ "${ks[$i]}" = "$key" ] && { es[i]=$now; found=1; break; } | ||
| done | ||
| [ "$found" = 1 ] || { ks+=("$key"); es+=("$now"); } | ||
| done | ||
| # One field per entry; printf adds the newline per argument, because a | ||
| # command-substitution accumulator would strip it and glue entries together. | ||
| local -a lines=() | ||
| for i in ${ks[@]+"${!ks[@]}"}; do | ||
| lines+=("$(printf '%010d %s' "${es[$i]}" "${ks[$i]}")") | ||
| done | ||
| local sorted e k | ||
| sorted=$(printf '%s\n' ${lines[@]+"${lines[@]}"} | sort -r | head -n 128) | ||
| while read -r e k; do | ||
| [ -n "$k" ] || continue | ||
| keep="${keep:+$keep;}${k}:${e}" | ||
| done <<< "$sorted" | ||
| tmp=$(mktemp "$RECORD.XXXXXX" 2>/dev/null) || return 1 | ||
| chmod 0600 "$tmp" 2>/dev/null || { rm -f -- "$tmp"; return 1; } | ||
| { | ||
| printf '%s\n' "$RECORD_SCHEMA" | ||
| printf 'seen=%s\n' "$keep" | ||
| } > "$tmp" || { rm -f -- "$tmp"; return 1; } | ||
| mv -f -- "$tmp" "$RECORD" || { rm -f -- "$tmp"; return 1; } | ||
| return 0 | ||
| } |
There was a problem hiding this comment.
The remote sweep applied the 32 KiB byte-tier floor to the service's own data location, so a small signed extract - a real 150-row copy is about 16 KiB - passed silently, and a clean-empty result was indistinguishable from a leg that never ran. The floor belongs to the generic local binary tier, not to a dedicated volume where any world-readable signature carrier is news regardless of size. The leg now always surfaces in scan's coverage: COVER with candidate counts when it ran, leer when the configured roots are absent, a named PARTIAL when unreachable or torn. Verified live against gex in both directions: a planted world-readable signed probe at the volume path is found and reported; an equally signed probe under /root/backups/hplan stays unreported. Both probes removed afterwards.
|
Abnahmerunde 3a - Ursache gefunden, gezogen, live gegengeprobt (2da543a): Ursache: Das Serverbein wendete die 32-KiB-Größenuntergrenze der lokalen Byte-Spur auch im Volumen an. Eine echte 150-Zeilen-Kopie ist aber nur ~16 KiB groß - sie fiel durch den Vorfilter, und ein leerer Erfolg war von einem Lauf, der nie geschah, nicht zu unterscheiden. Beides war der Defekt: die Grenze gehört in die allgemeine lokale Suche, nicht in das dedizierte Datenverzeichnis des Dienstes, und der Server musste sich in jeder Ausgabe zeigen. Jetzt:
Gegenmessung live am echten Ort, beide Richtungen: signierte synthetische Probe (150 Zeilen, erfundene Namen, 644) unter Batterie steht bei 20/20 grün inklusive dreier neuer Fälle (Lauf mit Zahl, fehlende Wurzeln als leer, Ausfall als PARTIAL ohne ok-Behauptung); shellcheck sauber. |
|
Landed locally in the operating fleet's local main (cherry-picked as d60fbbc + 3e28f35, colocated test green). This guard is domain-specific to one deployment's HPlan data handling, so it does not belong in the shared upstream; closing rather than merging. Apologies for the noise - our delivery mode for firstmate-repo tasks is local-only, and this branch was opened upstream by mistake. |
|
Speaking as Kun's firstmate: Scheduled 3:10am PT 8/24 pass. VISION.md read in full from current main VISION (inspected
Class: opt-in (must Security (file-mode/permissions, full diff): no Workflow-approval this pass (captain
CI / NM: HEAD Overlap / HOLD: none of the standing spawn/herdr/lock files. Unique Waiting on the author for a HEAD-matching attestation (and for fork CI to actually exist so it can be approved). The HPlan-in-distro question is a captain decision that would still block after that — not flagging NOW because author/CI blockers remain. Do not rebase. Land-eligible: NO. Captain-flag NOW: no. |
Ziel
Ein Wächter gegen die Fehlerfamilie der letzten Tage: weltlesbare Kopien der echten HPlan-Bestandsdaten - 229 Hallenbelegungen mit Klarnamen und Rufnummern echter Übungsleiter. Vier Vorkommen am 23./24.08., dazu am 24.08. die laufende Produktionsdatenbank selbst auf 644 als sechstes Vorkommen und Grund für den Serverblick.
Der Vorschlag: die Signatur hängt am Inhalt
Die Signatur ist die Form des Bestands selbst, nie der Name: Tabelle
belegungmit gefülltemuebungsleiter-Feld. Drei Stufen:sqlite-struktur: SQLite schreibfrei geöffnet (immutable - keine Sperren, kein Journal), Tabelle und Spalte nachgewiesen, mindestens 100 Zeilen mit gefülltem Feld. Schwellwert per Umgebungsvariable; der bekannte Bestand misst 229/229.byte-signatur: wenn keine Struktur lesbar ist - beide Schema-Token in NUL-haltigen Binärdaten oberhalb von 32 KiB. Trifft lebende und verwaiste WAL-Begleiter.dump-signatur: SQL-Text mit beiden Token plus INSERT nachbelegung. Prosa, die die Wörter nur erwähnt, meldet nicht.Warum das auch die nächste Kopie trifft: Jede künftige Kopie - docker cp, Skript, Handkopiervorgang, anderer Name, WAL-Abbild, Textabzug - trägt die Struktur ihres eigenen Inhalts mit, und genau darauf wird geprüft. Die Gegenprobe in der Batterie schiebt eine Kopie unter einem Namen unter, der mit keinem der bekannten Fälle etwas teilt.
Ehrlich gezogene Grenzen: Extrakte unter dem Zeilenschwellwert, komprimierte Container, gepackte Git-Objekte (komprimiert - ein committetes Leck ist eine andere Familie), Symlinks, und umbenannte Textabzüge ohne SQL-Form im Kopf.
Kosten (gemessen, nicht geschätzt)
checkinklusive Serverbein: 8,7 s bei einer Budgetgrenze von 20 s, automatisch auf das Watcher-Zeitlimit (30 s) zugeschnitten.treehouse-Pool nach Putsatz (~23k Dateien) 5,7 s, Serverbein über ssh rund 1 sstate/.hplan-guard, nur Hashes und Epochenn); Re-Nag standardmäßig täglichWas er nie tut
Kein Inhalt verlässt ihn - weder Meldung noch Protokoll noch Datensatz; der Test weist Sentinel-Werte in allen Ausgaben und State-Dateien nach. Er ändert nichts an gefundenen Dateien (Checksummen-Gegenprobe), repariert nichts und setzt keine Musterbefehle ab. Auf dem Server wird nur gelesen: ein Shell-Schnipsel per
bash -sgereicht, nichts hinterlassen, nichts neu gestartet;/root/backups/hplanbleibt ausgenommen und gegentestet.Abnahme Punkt für Punkt
test_finds_differently_named_copytest_silent_on_600_signed_copy,test_silent_on_unsigned_world_readable, plus Wort-Schergegenprobetest_remote_leg_respects_backup_exclusion, zusätzlich live gegen gex gefahrentest_no_content_leaves_the_scannertest_scanner_changes_nothingtest_scan_stays_fasttest_arm_disarm_roundtriptest_chaos_run_names_partials_and_stays_boundedbin/fm-test-run.sh tests/fm-hplan-guard.test.sh), shellcheck sauberAktivierung nach Merge
Im Heim einmal
bin/fm-hplan-guard.sh arm- danach ruft der Watcher ihn je Prüfzyklus auf, und die Meldung landet dort, wo der Kapitän sie sieht.disarmnimmt Shim, Vertrauensbindung und Datensatz komplett zurück. Das Ausrollen selbst bleibt bewusst dieser Entscheidung vorbehalten.Live-Befund des ersten Laufs (nur Metadaten)
Der erste echte Lauf fand acht weltlesbare Bestandskopien - die Familie lebt:
/tmp/claude-1000/-home-fridjof--treehouse-HPlan-c6c586-3-HPlan/…/scratchpad/wegwerf.sqlitesamt-wal- 644, strukturiert bestätigt/tmp/claude-1000/-home-fridjof--treehouse-HPlan-c6c586-1-HPlan/…/scratchpad/voll/quelle.sqlite- 644, 688 KB…/scratchpad/walprobe/sicherung.sqliteund…/walprobe/hplan.sqlite- 644, je 8 KB.treehouse/firstmate-7bab20/4/firstmate/data/hplan-ausrollen-2026-08-23/db-sicherung-vor-u4-2026-08-23.sqlite- 644, 348 KB.treehouse/HPlan-00fd4e/1/HPlan/daten/hplan.sqliteund…/2/HPlan/daten/hplan.sqlite- 644, je 312-348 KBDie Produktionsdatenbank im Docker-Volumen steht inzwischen auf 600 (nachgemessen), die Sicherungen dort liegen richtig. Über die obigen Funde entscheidet ein Mensch - der Wächter hat sie nur laut gemeldet.
Webrecherche: 0 Suchen verwendet.