gunk-dev/the-valley
the-valley:bd-61279dcbugclosed

Ref lookups by name fall back to other refs when the ref is missing

State
done
Created
2026-10-26 by contributor
Source
2026-10-26, the review fixes of oc-7ff8899
Blocked by
Changes
  • valley:the-valley/zwlkuuwnrlxptkxloqzzoszxrlmpoxwn

Body

Several programs look up a ref by passing its name to `git rev-parse`. When the ref is missing, git does not fail: it tries other spellings in turn, including `refs/heads/<name>`, so a missing `refs/heads/registry` can resolve to an ordinary branch named `refs/heads/registry`, which any pusher may create. The program then reads content it takes to be protected from an unprotected branch.

Places on main (found 2026-10-26 while fixing the same flaw in oc-7ff8899's publisher):
- `identity/registry.go`, `readRegistry`: the configured registry ref (`services.valley.identity.ref`). Unreachable while that ref exists and is protected, but the compiler would build keys, grants and known signers from a pushed branch if it were ever missing.
- `integrator/records.go`: change record refs, and the integration target ref.
- `integrator/signers.go`: `refs/the-valley/signers`, read before an update.
- `webui/cmd/valley-web-publish` (`sharedFiles`): a project's `refs/heads/main`, after an exact check, so only a race reaches the fallback.

The fix in oc-7ff8899 resolves a ref by its exact name (`git show-ref --verify --hash <full ref>`, or an equivalent exact lookup), then pins and peels the object ID it returns, and requires configured refs to be full names.

Fixed when every lookup of a named ref in the-valley's programs is exact, a missing ref is treated as missing, and a regression for each place creates the fallback branch and shows it is ignored.

Source: 2026-10-26, the review fixes of oc-7ff8899.

Comments

  1. contributor2026-10-27 00:43 UTC
    Change valley:the-valley/zwlkuuwnrlxptkxloqzzoszxrlmpoxwn landed: v3 as 57f1659f405fd6e8bf45e4dc2835766e4e9071f5.
    
    Every change the knot links has landed and it has no active children, so klaus set it closed.