hub: the app record a box feeds is bounded — per household, per name (security review of the D72 commit)

A box could send 300 new invented app names in every report and the
household's presence rows grew with no end.

- At most 400 names per household. A new name above that takes the place of
  the oldest ABSENT name the same report does not claim; when there is none it
  is not stored. Said once in the hub's log, not per report.
- A name is stored only when it is shaped like an app name (64 characters,
  letters, digits, . _ -) and is not reserved (_shares, the marker, the box's
  infrastructure stacks) — from the app list and from an end record alike.
  The same check decides what a window may agree to.
- No age limit on a row, on purpose: an aged-out row would start a real ended
  app's 30 days again. Making room never makes an app eligible earlier.

Tests TestD72_AppRecord_* (a box that sends new names in 40 reports);
10 mutations seen red, 2 after a redo.

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-15 13:33:33 +01:00
1 parent 01a106b78c
commit a63f5b2ba8
6 files changed
+385 -12

No files matched your search

@@ -0,0 +1,67 @@
== MUTATION: no limit per household
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_AppRecord_ABoxCannotFillIt (0.06s)
d72_app_record_bounds_test.go:56: report 0: the household holds 600 rows, limit 400 — a box can grow the table without end
--- FAIL: TestD72_AppRecord_RoomIsMadeFromUnclaimedAbsentRowsOnly (0.05s)
d72_app_record_bounds_test.go:119: no room was made: app-000 (absent, not claimed) is still there
== MUTATION: room is made from CLAIMED rows too (a real ended app loses its date)
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_AppRecord_ABoxCannotFillIt (0.68s)
d72_app_record_bounds_test.go:64: the real ended app lost its row or its date in the flood (want absent since 2026-06-02 00:00:00 +0000 UTC): {Present:false AbsentSince:0001-01-01 00:00:00 +0000 UTC} ok=false
--- FAIL: TestD72_AppRecord_RoomIsMadeFromUnclaimedAbsentRowsOnly (0.05s)
d72_app_record_bounds_test.go:119: no room was made: app-000 (absent, not claimed) is still there
== MUTATION: a new name above the limit is stored anyway
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_AppRecord_ABoxCannotFillIt (0.05s)
d72_app_record_bounds_test.go:56: report 0: the household holds 600 rows, limit 400 — a box can grow the table without end
--- FAIL: TestD72_AppRecord_RoomIsMadeFromUnclaimedAbsentRowsOnly (0.05s)
d72_app_record_bounds_test.go:130: rows = 402, want the limit 400
== MUTATION: the limit is said in the log at every report
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_AppRecord_ABoxCannotFillIt (0.63s)
d72_app_record_bounds_test.go:60: the limit was said 40 time(s) in the log, want once for 40 reports:
== MUTATION: any name from the app list is stored
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_AppRecord_OnlyAppNamesAreStored (0.05s)
d72_app_record_bounds_test.go:170: "_shares" was stored
d72_app_record_bounds_test.go:170: "felhom-offbox" was stored
d72_app_record_bounds_test.go:170: "traefik" was stored
== MUTATION: any name from an end record is stored
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_AppRecord_OnlyAppNamesAreStored (0.04s)
d72_app_record_bounds_test.go:170: "_shares" was stored
d72_app_record_bounds_test.go:170: "felhom-offbox" was stored
d72_app_record_bounds_test.go:170: "traefik" was stored
== MUTATION: no length limit on a name
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_AppRecord_OnlyAppNamesAreStored (0.05s)
d72_app_record_bounds_test.go:170: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" was stored
d72_app_record_bounds_test.go:179: rows = 7, want 6: map[Immich:{false 2026-11-15 00:00:00 +0000 UTC} a.b:{false 2026-11-15 00:00:00 +0000 UTC} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:{false 2026-11-15 00:
== MUTATION: a reserved name in another case is stored
*** NOT A RED-PROOF *** (mutant rc=1 built=False real rc=0)
FAIL gitea.dooplex.hu/admin/felhom-hub/internal/store [build failed]
== MUTATION: a name may start with a dot, a dash or an underscore (_shares)
*** NOT A RED-PROOF *** (mutant rc=1 built=False real rc=0)
FAIL gitea.dooplex.hu/admin/felhom-hub/internal/store [build failed]
internal/store/offsite_ended.go:79:6: declared and not used: i
== MUTATION: the reserved list does not hold the infrastructure stacks (hub agreement)
RED on the mutant, GREEN on the real file
--- FAIL: TestD84_AgreeEnded_TheHubsOwnRecordsDecide (0.00s)
ended_test.go:114: refusal for "traefik" = "", want it to say "not an app" (all: [{App:Samba Reason:not an app a household removes} {App: Reason:1 snapshot id(s) refused: listed under an app the hub refused} {App: Reason:1 snapsho
10 mutations, 2 not a red-proof
### the two mutations done again
== MUTATION: REDO (the first mutant did not compile: `strings` unused): a reserved name in another case is stored
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_AppRecord_OnlyAppNamesAreStored (0.04s)
d72_app_record_bounds_test.go:170: "Samba" was stored
d72_app_record_bounds_test.go:179: rows = 7, want 6: map[Immich:{false 2026-11-15 00:00:00 +0000 UTC} Samba:{true 0001-01-01 00:00:00 +0000 UTC} a.b:{false 2026-11-15 00:00:00 +0000 UTC} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
== MUTATION: REDO (the first mutant did not compile: `i` unused): a name may start with a dot, a dash or an underscore (_shares)
RED on the mutant, GREEN on the real file
--- FAIL: TestD72_AppRecord_OnlyAppNamesAreStored (0.04s)
d72_app_record_bounds_test.go:170: "_shares" was stored
d72_app_record_bounds_test.go:170: "." was stored
d72_app_record_bounds_test.go:170: ".." was stored
2 mutations, 0 not a red-proof