fix(daemon): bound nunciod's own keyring reads #424

Merged
KofTwentyTwo merged 1 commits from fix/bound-daemon-keyring into dev 2026-08-15 01:13:58 +00:00
1 Commits
Author SHA1 Message Date
james.maes 90eab25081 fix(daemon): bound nunciod's own keyring reads
nunciod mostly mints the key material it reads, so the OS keyring
normally answers without ceremony. That is a habit, not a guarantee: a
keychain locked by screen-lock, a restored or migrated keychain whose
ACL no longer trusts the binary, a re-signed or rebuilt nunciod, or a
Linux Secret Service with no unlocked collection all turn the read into
a wait on something nobody can answer. Unbounded, that left the daemon
hung at startup with no error and no log line.

Bound both of the daemon's key-material reads -- the gRPC bearer token
minted at startup and the webhook signing key provisioned on first CALL
WEBHOOK dispatch -- so each terminates with an honest, logged error that
names the key material and the likely cause. Startup still fails closed
through the same path it already used; only the hang case now reaches
it.

Lift the bounded read the CLI already uses into nuncio-store so both
binaries share one implementation. It still runs on a detached OS thread
behind a timeout rather than spawn_blocking: a keyring read cannot be
cancelled, and Tokio joins its blocking pool at shutdown, which would
merely relocate the hang to process exit.

The daemon deliberately gains no environment override. It mints and owns
the authoritative token and must never accept one from its environment.

Refs #421
2026-08-14 20:05:31 -05:00