gunk-dev/the-valley
the-valley:bd-818d87ebugopen

The publisher trusts policy/web file names, and its sandbox hides by list

State
free to start
Created
2026-10-26 by contributor
Source
2026-10-26, review of the web UI on main at ac8c5f17

Body

Two places in `valley-web-publish` trust more than they need to.

1. `policy/web` file names. `visibility.go` accepts any tree entry name that ends in `.cue` and joins it into a path under its scratch directory. A name with a directory part writes outside that directory, and git accepts such names on push by default. Getting one onto main needs approval, but the check is cheap: accept only a plain file name, and treat anything else as an invalid declaration. Also consider `receive.fsckObjects` on the host.
2. The sandbox (`nix/webui-publisher.nix`) hides a list of known secret paths (`InaccessiblePaths`), rather than exposing only what the pass reads. The git user's home is the data directory, so anything group-readable there, other than `.ssh`, is readable by a pass. Only address families are restricted; egress to any address is open. A fix: `TemporaryFileSystem=` over the data directory with `BindReadOnlyPaths=` for each repository the pass reads; `IPAddressDeny=any` with an allow for the receiver where feasible; `MemoryDenyWriteExecute`, `ProcSubset=pid` and a `SystemCallFilter` without `@privileged` and `@resources`.

Unverified: a declaration can redeclare `#Declaration` or `#Instance`, and CUE unifies repeated definitions, which would let it widen the schema. `DisallowUnknownFields` and the name checks in Go still hold, so they stay the real guards. A test through `readDeclaration`'s `cue export` path would settle it.

Fixed when a tree entry name with a directory part is refused as an invalid declaration, and the e2e probe shows a pass can read no undeclared repository's files and reach no address but the receiver's.

Source: 2026-10-26, review of the web UI as landed on main at `ac8c5f17`.

Comments

No comments.