gunk-dev/the-valley

bd-8a591dc-machine-credentials-never-expire.md

source90adebaf316bmain's published tip history
3.6 KiB · Rendered
1---
2type: bug
3id: bd-8a591dc
4status: closed
5title: Machine access is a permanent grant — provisioning is O(machines) and revocation never happens
6created: 2026-07-31
7source: provisioning a disposable agent VM against the pilot host, 2026-07-31
8---
9
10# Machine access is a permanent grant
11
12Granting a machine access to a valley host meant appending its public key to
13`services.valley.authorizedKeys` and rebuilding the host. The grant had no expiry, so it persisted
14until someone edited the list again. Nothing observed that the machine it was issued for had ceased
15to exist, and a disposable machine left its key behind when it went.
16
17Two costs followed, and they compounded as the number of machines grew.
18
19Provisioning was O(machines) with a human deploy in the loop. Each new machine needed a change to
20the host's declaration, review, a merge, and an interactive rebuild of the host. That was a deploy
21of the primary git host to grant read access to a scratch machine — an expensive motion to repeat,
22and one performed on the machine whose availability everything else depends on.
23
24Revocation was the harder cost, because it never happened on its own. A key list only shrank when a
25human noticed an entry was dead and removed it, and nothing prompted that noticing. Ephemeral
26machines are exactly the case where the grant outlives the grantee, so the list accreted standing
27grants to destroyed hosts. Each entry reached every project on the host, because access was
28host-level by design.
29
30## The resolution
31
32The identity registry ([[dcr-b87f6e8]]
33([dcr-b87f6e8-identity-is-a-governed-registry.md](../decisions/dcr-b87f6e8-identity-is-a-governed-registry.md)))
34replaces the hand-maintained key list. Machine and service entries carry mandatory expiry, and
35expiry is enforced at compilation: the step that renders the registry into the artifacts a boundary
36checks — the host's authorized keys among them — refuses expired entries. Access ends at the first
37convergence after expiry, with no separate revocation act. Provisioning a machine is now a registry
38entry rather than a host declaration, so granting it no longer requires a rebuild of the primary
39host for each machine.
40
41The compiler is [identity/](../../../identity/), staged first against the host's push boundary — the
42same boundary this bug was raised against. A compilation that fails for any reason leaves the last
43good artifacts as they were, so a bad registry edit cannot lock the host's git user out; the
44declared keys remain the way back in.
45
46## Why the risk was tolerable before this landed
47
48Every key in the list belonged to the operator, the host was reachable only over a private tailnet,
49and the projects were small in number. A stale entry was a key nobody held on a host nobody else
50could route to. The defect was one of scale and hygiene, not a live exposure.
51
52## Related
53
54The instance-level counterpart is qinling's `dcr-34b3f6d` (keys partition by capability), which
55observes that the pilot host's key inventory conflates decryption, authentication, and human
56signing, and wants it partitioned by capability. Splitting a git-only class out of the inventory's
57user list — done for the machine that surfaced this bug — separates authentication from decryption
58for one member, and was a down payment on that partition rather than a substitute for it.
59
60Short-lived certificates issued per instance are the direction machine access is still moving
61toward; the issuance service and what authenticates an issuance request remain open in
62[[dcr-b87f6e8]]
63([dcr-b87f6e8-identity-is-a-governed-registry.md](../decisions/dcr-b87f6e8-identity-is-a-governed-registry.md)).