Live on demo-hp (--rotate-recovery-only): vault time moved, new value 200, old 401. Harness 52/0; the R1145 cases fail against HEAD. Publishes only with the next installer tag.
9.8 KiB
Independent security review — P2, 2026-10-18
Reviewer: independent (did not write the code). Read-only. Adversarial threat model per the brief.
Diffs reviewed:
- felhom-controller
5d67041..03ab121(v0.328.0 → v0.329.0):internal/privpolicy,internal/stacks/allowlist.go,internal/web/storage_handlers.go,internal/agentapi/client.go,build.sh. - app-catalog-felhom.eu
0140fff..fc93846:scripts/check-privileges.py,templates/homepage. - felhom.eu hub
7d64038f: agent-only vouch (internal/web/configs.go),internal/accesslog,internal/offsitekeys/snapshot_watch.go+service.go+store/offsite_snapshots.go, theaccesslog.Markcall sites. - felhom-agent
6545ccc: orphan thin-check only after a failed snapshot step. - felhom.eu installer
7d64038f:--rotate-recovery-only.
Architecture consulted: 02-controller-module-map.md "The catalog allow-list"; 05-hub-architecture.md (Day-0 manifest, R-120 guard, §16.4); 07-backup-architecture.md (off-site custody, R-822/R-895); runbooks/break-glass.md.
Findings
F1 (medium) scripts/felhom-host-install.sh ~1767–1783 (the --rotate-recovery-only healthz pre-check) + step_break_glass ~1657
The pre-flight that is supposed to stop a rotation that cannot be vaulted uses the wrong credential, so a stale/invalid host key leaves root@pam rotated-but-unvaulted.
Scenario: operator runs --rotate-recovery-only on an appliance box whose hub.api_key in agent.json is stale (host deleted/re-enrolled at the hub, or a copied/old config). The mode's only gate before the destructive chpasswd is http_code "$HUB_URL/healthz" — an unauthenticated endpoint. healthz returns 200, so the script proceeds; step_break_glass generates a new random password, sets it with chpasswd, then PUT /hosts/$HOST_ID/recovery-credential with Bearer $HOST_API_KEY returns 401/403 → die. At that point root@pam has already been changed to a random string that was never vaulted; the hub still holds the old credential, which no longer works. The PVE web console (:8006) — the layer-3 break-glass path this mode exists to maintain — is now unreachable with any known password.
The code comment claims the healthz check covers "a vault that fails AFTER chpasswd leaves a password nobody holds", but healthz exercises no auth, whereas the vault PUT needs the host key — a different channel, so the pre-check cannot catch the failure it is meant to prevent (the same class as the R-286 "control from a different channel" rule). In the full install this is masked because step_enroll validates the host key before step_break_glass; the new standalone mode has no enroll, so nothing confirms the key is good before the irreversible chpasswd.
Fix direction: before chpasswd, make one host-key-authenticated call (e.g. GET /api/v1/hosts/$HOST_ID/desired-state with the Bearer key) and refuse the rotation if it is not 2xx. Confidence: confirmed by reading.
F2 (low–medium) hub/internal/offsitekeys/snapshot_watch.go:62–73 (explainedByRun) + hub/internal/store/offsite_snapshots.go (OffsiteRunTimesSince)
The "unexplained snapshot" (fake-injection) alarm trusts the box's own self-reported run times, so an attacker holding the box's key can suppress it.
offsite_snapshots_unexplained fires only when a newly-appeared snapshot's upload time is not near any offsite.last_run the box reported. But OffsiteRunTimesSince reads those run times from the customer's report_json — data produced by the same guest an attacker who holds the append-only key typically already controls. An attacker who uploads a fabricated snapshot through the box's add-only key can also have the box report a last_run whose time brackets the injected file's mtime, so explainedByRun returns true and no warning is raised. The injection signature the alarm is built to catch is defeatable by the very actor it targets.
This is partly acknowledged in the design ("Fakes added with the box's key would look like this; a crashed run would too"), and the custody-critical half — offsite_snapshots_vanished — is not affected: it is judged on the hub's own name listing against hub-side window credits (WindowCreditsBetween), a channel the box cannot forge, and correctly uses the full listing l.Entries (not the settle-filtered next) for the "still present" test, so a too-new file is not mistaken for a deletion. Reported because the brief explicitly asks about faking the off-site alarms; the deletion alarm is the one that matters most and it is sound. Confidence: confirmed by reading.
F3 (low) controller/internal/web/storage_handlers.go:544–572 ("anyway") + finalizeDecommissionWith ~608
Decommission-anyway stops the drive's apps before the agent is asked; on an agent policy refusal the apps are left stopped with nothing retired (half-state).
The handler calls StopStack on every app whose HDD_PATH is the target drive, then finalizeDecommission. With the R-1063 reorder the agent is now asked first and can refuse with 403 (protected role) or 409 (whole-guest backup target); on that refusal the function returns and nothing is marked — but the apps were already stopped and are not restarted, so a household that presses "decommission anyway" on a drive that is also the backup target ends with its apps down and a 409. This is not newly introduced (the stop always preceded finalizeDecommission), and the reorder is a net improvement for the mark/agent consistency the comment describes (previously the registry was marked decommissioned while the agent kept serving). Noted as a residual half-state the retirement change did not close. Confidence: confirmed by reading.
F4 (low) scripts/felhom-host-install.sh step_break_glass ~1685 (unchanged, moved)
The host API key is passed in curl argv (-H "Authorization: Bearer $HOST_API_KEY") during the vault PUT, visible in process args while the call runs. The password is handled correctly (stdin→chpasswd, stdin→curl -d @-, scrubbed), but the host key rides on the command line. On a PVE host this is root-only and the code is moved verbatim from the original step, so it is pre-existing, not a regression. Worth a line because --rotate-recovery-only makes this a standalone, operator-run path. Confidence: confirmed by reading.
Checked and found sound
- Per-app appdata root (R-1142).
AppdataFoldernarrows${HDD_PATH}toappdata/<the app's own folder>; a template named like another app's mapped folder (e.g.paperlessvspaperless-ngx→paperless) gets no root (reverse-lookup overappdataFoldersvalues), an app with no usable name gets no root (fail-closed),oneSegmentrejects/ \ $ . .. "", and a duplicate folder mapping panics at load. Another app's folder/sub-folder/the wholeappdata/a prefix-collision name/a literal path to another app are all refused; tests pin each case. - Catalog CI parity.
scripts/privilege-allowlist.jsonis byte-identical to the compiledallowlist.json(both v2, empty entries,paperless-ngx→paperless);check-privileges.py'sone_segment/appdata_folder/reverse-lookup/duplicate-folder checks mirror the Go, andapp= the template's top-level dir name, matching the box'sappName. - USERDATA_PATH can no longer be named by a template.
policyEnvdeletes any app-envUSERDATA_PATHand re-derives it; the runtime converges on the same value — Goexecdedupscmd.Envto the last occurrence andenvLookup/ensureUserdataMounts/renderMediaOverrideall read the last match, which is thewithPathVars-appended derivation, so an injectedapp.yaml USERDATA_PATHwins neither the check nor the bind.IMPORT_PATHis likewise always controller-derived or unset. - Docker socket is refused everywhere. Empty allow-list ⇒ any
docker.sockbind (short/long syntax,/runor/var/run,.socksuffix, or a symlink whoseEvalSymlinkstarget leaves the root) is a violation with no allowed entry; homepage's template no longer mounts it andTestAllowList_HasNoExceptionAndRefusesHomepagesSocketred-proofs the removal. Controller-infra stack names are refused incopyTemplates. - Agent-only vouch. The R-120 gate is skipped only when the submitted golden equals the vouched one in both version and sha256; a changed version or a same-version re-push (different sha, freshly resolved from the registry) is still judged and refused if behind the fleet (test-pinned). The R-273 tag+package installability gate, the bundle-sha resolve, and operator-only
RequireAuth/CSRF are all intact; MinAgent floor logic is untouched. Nothing was loosened that lets a stale/wrong golden be saved. - Access log. Query string dropped entirely; path segments ≥32 chars and the
/bind/<token>capability redacted;cred/authrecord only the kind, never a value (Authorization, session cookie,X-Retrieval-Password→ names only). Recovery-credential PUT keeps the password to body + hub log prints only user+length. A logging failure never fails/delays the request (non-blocking channel, rate-limited error); prune removes only exactaccess-YYYY-MM-DD.lognames. No request shape observed that lands a secret in a line. - Agent orphan thin-check reorder.
thinChecknow runs only fromexplainFailure(vzdump start/task failure), bounded by a 2-minutecontext.WithoutCanceltimeout, read-only; the success path no longer snapshots the live pool. Capability manifest description updated to match. - build.sh.
:latestmoves only for a release tag matching^[0-9]+\.[0-9]+\.[0-9]+$; rc/dev tags push only their own tag. - agentapi typed refusals.
ErrNoDurableID(409 + "has no durable id") andDecommissionRefusedError(403→protected, 409→backup-target) carry only the agent's truncated reason text, never bodies/secrets; the agent-side role gate fails safe to protected on an unresolvable mount.