gunk-dev/the-valley

bd-75c8721-pushes-could-write-any-namespace.md

sourceef0e6a83672emain's published tip history
4.2 KiB · Rendered
1---
2type: bug
3id: bd-75c8721
4status: closed
5title: A push could write any namespace the hook did not name, replacement refs included
6created: 2026-10-04
7source: adversarial review of the push boundary, 2026-10-04
8---
9
10# A push could write any namespace the hook did not name
11
12The pre-receive hook guarded two things: protected refs, and the create-only attestation namespace.
13Every other ref was open to any key that could push. Two of those open namespaces were holes.
14
15The first was `refs/replace/*`. A replacement ref makes git read one object in place of another,
16wherever git looks the first one up. git honours replacement refs by default. The identity compiler
17read the registry from the instance repository's tip with plain `git ls-tree` and `git show`, and
18the integrator read the floor, the project's policy and a change's tree the same way. So a pushed
19`refs/replace/<blob>` could swap in a registry that authorized any key as anything, or a floor that
20required nothing, without moving a ref anyone watches. Every reader would have agreed on the forged
21content, because every reader asks git the same question.
22
23The second was the integration-request namespace. [[dcr-e544f20]]
24([decisions/dcr-e544f20-access-is-verbs-on-projects.md](../decisions/dcr-e544f20-access-is-verbs-on-projects.md))
25defines a request verb whose gate is a check of namespace writes against the principals holding it.
26No such check existed, so any key that could push could ask for anything to land. Who may file
27requests is the human gate on a valley whose floor demands approval statements, so the verb had to
28ship with its gate.
29
30## The resolution
31
32The hook's rules are one Go program, [valleyhook/](../../valleyhook/), and the hook a host installs
33only hands it the pushing principal, the project's declared protection, and the grants. It holds
34every push to an allowlist. Protected refs take a push only from a declared writer. Attestation refs
35are create-only. Integration requests take a write only from a principal holding the request grant.
36Topic branches are open. Every other namespace is refused, and replacement refs are refused to every
37push, declared writers included. A project opens any other namespace — release tags are the expected
38case — with an `allow` entry in its protection block, naming the principals it opens to.
39
40The request grant is a boundary kind in the identity schema, `"request"`. The compiler writes each
41holder into a grants file the hook reads. A host can also grant it by hand, which matters the first
42time: the hook refuses the request that would land the registry change granting request, unless the
43host already grants it to whoever files that change.
44
45Replacement refs are also turned off wherever git is read for a decision: in the identity compiler,
46in the integrator and every program it runs, and in the `valley` CLI. Each one also drops the
47inherited `GIT_*` variables that could point git at other objects. A replacement ref already on a
48host is therefore inert, and valley-init reports any it finds on every activation without deleting
49it.
50
51## What remains
52
53A project without a protection block gets no hook, so its refs stay open to any push, replacement
54refs included. The readers that make decisions no longer honour them there either. That openness is
55what declaring no protection means.
56
57The hook does not check that an attestation ref's key hash belongs to the principal pushing it. The
58signer and the pusher are routinely different principals. A host's own key signs the claims
59`attest run` makes on it, and the operator's key pushes them.
60
61The request namespace does not record who filed a request. Any holder of the grant can therefore
62replace or withdraw any request, not only its own. The grant is the boundary: who holds request is
63decided in the registry, and the registry is governed.
64
65## Related
66
67- [[dcr-e544f20]]
68 ([decisions/dcr-e544f20-access-is-verbs-on-projects.md](../decisions/dcr-e544f20-access-is-verbs-on-projects.md))
69 — the request verb, whose gate this ships.
70- [[dcr-b87f6e8]]
71 ([decisions/dcr-b87f6e8-identity-is-a-governed-registry.md](../decisions/dcr-b87f6e8-identity-is-a-governed-registry.md))
72 — the registry the grant compiles from, and the boundary rule it follows.