capability: agent privileged-capability self-probe (manifest + build-test + runtime snapshot) v0.44.0

New internal/capability: Manifest of required sudo -n grants + Prober that LISTS each
via 'sudo -n -l' (never executes) + binary-exists check → ok/degraded snapshot on the hub
report. Build-time test asserts manifest⊆sudoers (red-proof: dropping lxc-info FAILs the
gate). Startup logs N/N ok + ERROR per degraded. Serve-degraded; no allowlist change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EPZ4GJ8L5Jqf8UiPwbn1kt
This commit is contained in:
2026-06-29 18:43:49 +02:00
parent 19582046ba
commit 25024d9dda
10 changed files with 584 additions and 11 deletions
+28 -1
View File
@@ -3,7 +3,34 @@
All notable changes to **felhom-agent** are recorded here. Update on every code
change that gets pushed.
## (unreleased) — sudoers completeness audit: close non-root allowlist gaps (no binary change) (2026-06-29)
## v0.44.0 — privileged-capability self-probe (build-time manifest test + runtime probe + hub snapshot) (2026-06-29)
The agent now self-checks the `sudo -n` grants it depends on, so a missing allowlist entry (the
2026-06-28 cutover class: lxc-info/make-private/…) is caught LOUD — in CI at build time and on the
host at runtime — instead of surfacing days later as user-visible breakage. **First slice of agent
self-health; the controller↔agent channel check is a separate later task.**
- **`internal/capability` (NEW):** a `Manifest()` of the required `(binary, representative-arg)`
vectors (seeded from the 2026-06-29 audit — the OK + CLOSED rows; the SURFACED/DEFERRED rows
`pct exec *`/`pct create`/`mount UUID`/`sensors` are deliberately excluded). `Prober.Probe` lists
each against the live policy with `sudo -n -l -- <binary> <args>` (a policy LIST — **never
executes**, safe for mkfs/pct entries) via a DIRECT runner, plus an `os.Stat` existence check,
mapping to `ok` / `degraded` ("sudo policy denied" | "binary not found"). A total sudo failure
(drop-in missing) collapses to ONE aggregate signal. Serve-degraded: the probe never blocks
startup, panics, or errors.
- **Build-time gate (`manifest_test.go`):** parses `configs/felhom-agent.sudoers`, translates each
glob to a regex, and asserts **every manifest vector is covered by a grant** — exactly what would
have caught the dropped `lxc-info`/`make-private` lines in CI. Includes a **red-proof**: with the
`lxc-info` line removed from an in-memory copy, the check FAILS for `guest-init-pid` (and passes
on the real file) — proving the gate is not hollow.
- **Runtime wiring:** `Probe` runs once at startup (INFO `capabilities self-check N/N ok`, plus an
ERROR per degraded capability naming the gated feature) and on every hub-report cycle; the snapshot
rides the report as the new non-nil `HostReport.Capabilities []capability.Status` (golden +
contract test updated; cross-repo hub copy mirrors it).
- **No allowlist change**; the live host is post-audit complete, so the probe reports N/N ok — itself
a live proof the probe agrees with the fixed sudoers. Version `0.43.0 → 0.44.0`.
## (sudoers completeness audit, folded into v0.44.0) — close non-root allowlist gaps (2026-06-29)
A full audit of every privileged command the agent shells via `sudo -n` against
`configs/felhom-agent.sudoers`, closing the read-only/fixed-vector gaps left by the 2026-06-28