Do not merge before #88 (the read-only judgement), which this branch is stacked on. #88 merges and delivers first, it is run on all four nodes, and that list replaces the survey below.
Why (issue 358, decided on the issue 2026-10-11). A mesh directory outside every home was given its mode and owner by path (os.Chmod, os.Chown in applyDirectory via chmodDirPath and own), which follow a link anywhere in the path. Whoever could turn a parent into a link between two applies directed root's chmod and chown at the link's target.
What changes (the node-engine; the walk itself is #88's)
Outside every home, the directory is made and given its mode and owner through the descriptor of #88's walk (openMeshDir, mesh_dirs_apply_linux.go): from /, O_DIRECTORY|O_NOFOLLOW per component, mkdirat in the parent's descriptor, fchmod/fchown on the descriptor, read back from it. Parents it makes inside the owner's home are given to the owner through their descriptors (ADR 0182). A parent link is followed only when root alone could have made it: the link is root's, and every directory from / to it is root's and writable by no other account.
A directory the walk refuses is a refusal like the placement guard's (review 47):
It is judged before anything is applied, in refusedPlaces, so it gates its module and refuses what is below it whatever the declaration order.
It is judged again when the directory is applied, including a directory used as found, which before returned without any walk.
A refusal at that moment of use joins in.refused. It gates its module (the issue-495 gate), and applyOne's guard refuses a file or archive below it (belowRefused over in.refused).
No file is written into the link's target, and the report names the module as not attempted.
created and the error text now compare against the path the walk reached, not the path declared (review 47, non-blocking).
Unchanged:
below a home, ADR 0266's walk still applies;
a handed-over directory keeps its stricter no-link rule (issue 356) and is not pre-judged by this walk;
a directory that is itself a link stays refused (issue 339).
How it was tested
mesh_dirs_gate_test.go (review 47's probe, through Apply):
a module's directory behind a link in a world-writable tree, a file of the module below it, and another module's file. The directory is refused, the file is not written into the link's target and is reported skipped, the report says the rest of the module was not attempted, and the other module's file is applied;
the same with the link judged trusted by the guard's walk and untrusted by the apply's, which is a refusal at the moment of use.
Both fail on the previous head 34a5aa5. The second also fails with only the apply's in.refused and belowRefused lines removed (a file written into the link's target, reported created).
replay358_test.go (the replay, uses only what main had): a parent swapped for a link after an apply; the target keeps mode 755. It fails on main.
mesh_dirs_test.go:
a root-only link is followed, absolute and relative;
a link another account owns is refused, naming the account;
a missing directory is made behind a root-only link.
./merge-check.sh green (bus tests skipped, no nats-server here). No test runs as root, so no test exercises fchown to another account.
Survey so far (2026-10-12, by stat and readlink of every path component; superseded by #88's judgement once delivered):
g14 (53 directories), shanks (48) and ace (162): none would be refused. The only link in any declared path is /var/run -> ../run, root's, in root's /var and /.
novox (123 directories): not checked. No tool reads a path there.
Replay: R358, to register in mesh-lab after merge: InRepository, mesh-host, ./internal/apply, TestAParentSwappedForALinkLeavesItsTargetUntouched, internal/apply/replay358_test.go.
Fixes issue 358.
**Do not merge before #88** (the read-only judgement), which this branch is stacked on. #88 merges and delivers first, it is run on all four nodes, and that list replaces the survey below.
**Why** (issue 358, decided on the issue 2026-10-11). A mesh directory outside every home was given its mode and owner by path (`os.Chmod`, `os.Chown` in `applyDirectory` via `chmodDirPath` and `own`), which follow a link anywhere in the path. Whoever could turn a parent into a link between two applies directed root's chmod and chown at the link's target.
**What changes** (the node-engine; the walk itself is #88's)
- Outside every home, the directory is made and given its mode and owner through the descriptor of #88's walk (`openMeshDir`, `mesh_dirs_apply_linux.go`): from `/`, `O_DIRECTORY|O_NOFOLLOW` per component, `mkdirat` in the parent's descriptor, `fchmod`/`fchown` on the descriptor, read back from it. Parents it makes inside the owner's home are given to the owner through their descriptors (ADR 0182). A parent link is followed only when root alone could have made it: the link is root's, and every directory from `/` to it is root's and writable by no other account.
- **A directory the walk refuses is a refusal like the placement guard's (review 47):**
- It is judged before anything is applied, in `refusedPlaces`, so it gates its module and refuses what is below it whatever the declaration order.
- It is judged again when the directory is applied, including a directory used as found, which before returned without any walk.
- A refusal at that moment of use joins `in.refused`. It gates its module (the issue-495 gate), and applyOne's guard refuses a file or archive below it (`belowRefused` over `in.refused`).
- No file is written into the link's target, and the report names the module as not attempted.
- `created` and the error text now compare against the path the walk reached, not the path declared (review 47, non-blocking).
- Unchanged:
- below a home, ADR 0266's walk still applies;
- a handed-over directory keeps its stricter no-link rule (issue 356) and is not pre-judged by this walk;
- a directory that is itself a link stays refused (issue 339).
**How it was tested**
- `mesh_dirs_gate_test.go` (review 47's probe, through `Apply`):
- a module's directory behind a link in a world-writable tree, a file of the module below it, and another module's file. The directory is refused, the file is not written into the link's target and is reported skipped, the report says the rest of the module was not attempted, and the other module's file is applied;
- the same with the link judged trusted by the guard's walk and untrusted by the apply's, which is a refusal at the moment of use.
- Both fail on the previous head 34a5aa5. The second also fails with only the apply's in.refused and belowRefused lines removed (a file written into the link's target, reported created).
- `replay358_test.go` (the replay, uses only what main had): a parent swapped for a link after an apply; the target keeps mode 755. It fails on main.
- `mesh_dirs_test.go`:
- a root-only link is followed, absolute and relative;
- a link another account owns is refused, naming the account;
- a missing directory is made behind a root-only link.
- `./merge-check.sh` green (bus tests skipped, no nats-server here). No test runs as root, so no test exercises `fchown` to another account.
**Survey so far** (2026-10-12, by `stat` and `readlink` of every path component; superseded by #88's judgement once delivered):
- g14 (53 directories), shanks (48) and ace (162): none would be refused. The only link in any declared path is `/var/run -> ../run`, root's, in root's `/var` and `/`.
- novox (123 directories): not checked. No tool reads a path there.
**Replay**: R358, to register in mesh-lab after merge: `InRepository`, mesh-host, `./internal/apply`, `TestAParentSwappedForALinkLeavesItsTargetUntouched`, `internal/apply/replay358_test.go`.
Fixes issue 358.
Deliverynovox/mesh-host@e3c3bb37d0cd — delivered since 2026-10-12T13:17:38Z
Delivery plan — builds mesh-host → ace, g14, novox, shanks; no bus step
tier 0: mesh-host
ace: receives mesh-host
g14: receives mesh-host
novox: receives mesh-host
shanks: receives mesh-host
grants step: if this changes what the bus's user list says (a new tool, subject or user), novox is sent that list alone, every build there kept, before mesh-host is judged on its first machine
Machines
mesh-host on ace: passed — healthy 3 times over 2m44s
mesh-host on the rest running it: sent
Transitions
2026-10-12 12:01 (new) → proposed (announced): novox/mesh-host#87's head announced
2026-10-12 12:03 proposed → checked (checked): the verdict names this commit
2026-10-12 12:03 checked → ready (accepted): the gate passed or warned, and the repository's own check did not fail
2026-10-12 13:13 ready → published (merged): on the trunk its modules follow: merged there, and its walk opened — or nothing for a walk to move
2026-10-12 13:13 published → delivering (go): its walk started: let go by this owner in its group's order, by a person, or on the controller's own path — not a failed walk that carried a later commit for it, after which it waits for a walk of its own commit
2026-10-12 13:17 delivering → delivered (done): its walk is done, carrying its own commit: every machine of its deploy plan passed, or was left as its policy says
The commit's note under refs/notes/mesh-plan keeps every transition: git log --notes=mesh-plan.
<!-- mesh-delivery:view -->
**Delivery** `novox/mesh-host@e3c3bb37d0cd` — **delivered** since 2026-10-12T13:17:38Z
**Delivery plan** — builds mesh-host → ace, g14, novox, shanks; no bus step
- tier 0: mesh-host
- ace: receives mesh-host
- g14: receives mesh-host
- novox: receives mesh-host
- shanks: receives mesh-host
- grants step: if this changes what the bus's user list says (a new tool, subject or user), novox is sent that list alone, every build there kept, before mesh-host is judged on its first machine
**Machines**
- mesh-host on ace: passed — healthy 3 times over 2m44s
- mesh-host on the rest running it: sent
**Transitions**
- 2026-10-12 12:01 (new) → proposed (announced): novox/mesh-host#87's head announced
- 2026-10-12 12:03 proposed → checked (checked): the verdict names this commit
- 2026-10-12 12:03 checked → ready (accepted): the gate passed or warned, and the repository's own check did not fail
- 2026-10-12 13:13 ready → published (merged): on the trunk its modules follow: merged there, and its walk opened — or nothing for a walk to move
- 2026-10-12 13:13 published → delivering (go): its walk started: let go by this owner in its group's order, by a person, or on the controller's own path — not a failed walk that carried a later commit for it, after which it waits for a walk of its own commit
- 2026-10-12 13:17 delivering → delivered (done): its walk is done, carrying its own commit: every machine of its deploy plan passed, or was left as its policy says
The commit's note under `refs/notes/mesh-plan` keeps every transition: `git log --notes=mesh-plan`.
mesh/merge-gate: PASS — every machine composes with the change as it did without (4 of 4 compose) (modules: mesh-host)
mesh/repo-check: PASS — its merge-check.sh passed
Delivery plan — builds mesh-host → ace, g14, novox, shanks; no bus step
tier 0: mesh-host
ace: receives mesh-host
g14: receives mesh-host
novox: receives mesh-host
shanks: receives mesh-host
grants step: if this changes what the bus's user list says (a new tool, subject or user), novox is sent that list alone, every build there kept, before mesh-host is judged on its first machine
read by no module's build: internal/apply/mesh_dirs_test.go, internal/apply/replay358_test.go
Run by the build seat on g14 as build-1791804712871957557 (builds --log build-1791804712871957557).
--- the gate: mesh-host
mesh-host: ok
long-running resources without health: 0
files asking for a setting without saying whether it is trusted: 0
1 manifest(s) checked. Judged against the seats this binary carries; a claim on one of the mesh's own seats is judged fully at registration, and a seat declared by a module not given here reads as unknown. Identities judged on a 6-character machine name, against the bounds of the providers given here
judging 0 module(s) changed against 4 machine(s), as the snapshot of 2026-10-12T11:32:09Z says they run
composing every machine as the mesh is
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
composing every machine with the change
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
merge gate: PASS — every machine composes with the change as it did without (4 of 4 compose)
judged by controller development build against the facts of 2026-10-12T11:32:09Z
machines:
- a machine (f35): composes
- holds mesh-dns-resolver (idt): composes
- holds git, holds mesh-artifact-store, holds mesh-broker, holds mesh-catalog, holds mesh-delivery, holds mesh-dns-resolver, holds mesh-store, holds mesh-vault, holds npm-package-registry, the control node, the hub (ygcyr): composes
- a machine (yvbpsm): composes
a merge would rebuild 1 module(s) in 1 tier(s): mesh-host
notes:
- internal/apply/mesh_dirs_test.go and internal/apply/replay358_test.go read by no module's build, and rebuild nothing (issue 280)
--- its merge-check.sh (go toolchain)
ok github.com/novox/mesh-host/cmd/mesh-bootstrap 1.015s
ok github.com/novox/mesh-host/cmd/mesh-host 7.310s
ok github.com/novox/mesh-host/examples 1.019s
ok github.com/novox/mesh-host/internal/accounts 3.296s
ok github.com/novox/mesh-host/internal/apply 2.975s
ok github.com/novox/mesh-host/internal/bootstrap 1.399s
ok github.com/novox/mesh-host/internal/bundle 1.022s
ok github.com/novox/mesh-host/internal/declaration 1.071s
ok github.com/novox/mesh-host/internal/firewall 1.733s
ok github.com/novox/mesh-host/internal/identity 1.052s
ok github.com/novox/mesh-host/internal/image 1.024s
ok github.com/novox/mesh-host/internal/inventory 1.024s
ok github.com/novox/mesh-host/internal/link 10.475s
ok github.com/novox/mesh-host/internal/liveness 2.078s
ok github.com/novox/mesh-host/internal/meshcli 1.558s
ok github.com/novox/mesh-host/internal/network 1.048s
ok github.com/novox/mesh-host/internal/outward 1.024s
ok github.com/novox/mesh-host/internal/profile 1.542s
ok github.com/novox/mesh-host/internal/reachable 1.017s
ok github.com/novox/mesh-host/internal/store 1.132s
ok github.com/novox/mesh-host/internal/system 1.018s
ok github.com/novox/mesh-host/internal/tunnel 1.021s
ok github.com/novox/mesh-host/internal/units 1.014s
ok github.com/novox/mesh-host/internal/upgrade 1.086s
ok github.com/novox/mesh-host/internal/witness 2.522s
ok github.com/novox/mesh-host/packaging 1.012s
? github.com/novox/mesh-host/rootsearch [no test files]
ok github.com/novox/mesh-host/validate 1.012s
**Merge check** at `df7e47e1`
- `mesh/merge-gate`: **PASS** — every machine composes with the change as it did without (4 of 4 compose) (modules: mesh-host)
- `mesh/repo-check`: **PASS** — its merge-check.sh passed
**Delivery plan** — builds mesh-host → ace, g14, novox, shanks; no bus step
- tier 0: mesh-host
- ace: receives mesh-host
- g14: receives mesh-host
- novox: receives mesh-host
- shanks: receives mesh-host
- grants step: if this changes what the bus's user list says (a new tool, subject or user), novox is sent that list alone, every build there kept, before mesh-host is judged on its first machine
- read by no module's build: internal/apply/mesh_dirs_test.go, internal/apply/replay358_test.go
Run by the build seat on g14 as `build-1791804712871957557` (`builds --log build-1791804712871957557`).
```
--- the gate: mesh-host
mesh-host: ok
long-running resources without health: 0
files asking for a setting without saying whether it is trusted: 0
1 manifest(s) checked. Judged against the seats this binary carries; a claim on one of the mesh's own seats is judged fully at registration, and a seat declared by a module not given here reads as unknown. Identities judged on a 6-character machine name, against the bounds of the providers given here
judging 0 module(s) changed against 4 machine(s), as the snapshot of 2026-10-12T11:32:09Z says they run
composing every machine as the mesh is
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
composing every machine with the change
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
merge gate: PASS — every machine composes with the change as it did without (4 of 4 compose)
judged by controller development build against the facts of 2026-10-12T11:32:09Z
machines:
- a machine (f35): composes
- holds mesh-dns-resolver (idt): composes
- holds git, holds mesh-artifact-store, holds mesh-broker, holds mesh-catalog, holds mesh-delivery, holds mesh-dns-resolver, holds mesh-store, holds mesh-vault, holds npm-package-registry, the control node, the hub (ygcyr): composes
- a machine (yvbpsm): composes
a merge would rebuild 1 module(s) in 1 tier(s): mesh-host
notes:
- internal/apply/mesh_dirs_test.go and internal/apply/replay358_test.go read by no module's build, and rebuild nothing (issue 280)
--- its merge-check.sh (go toolchain)
ok github.com/novox/mesh-host/cmd/mesh-bootstrap 1.015s
ok github.com/novox/mesh-host/cmd/mesh-host 7.310s
ok github.com/novox/mesh-host/examples 1.019s
ok github.com/novox/mesh-host/internal/accounts 3.296s
ok github.com/novox/mesh-host/internal/apply 2.975s
ok github.com/novox/mesh-host/internal/bootstrap 1.399s
ok github.com/novox/mesh-host/internal/bundle 1.022s
ok github.com/novox/mesh-host/internal/declaration 1.071s
ok github.com/novox/mesh-host/internal/firewall 1.733s
ok github.com/novox/mesh-host/internal/identity 1.052s
ok github.com/novox/mesh-host/internal/image 1.024s
ok github.com/novox/mesh-host/internal/inventory 1.024s
ok github.com/novox/mesh-host/internal/link 10.475s
ok github.com/novox/mesh-host/internal/liveness 2.078s
ok github.com/novox/mesh-host/internal/meshcli 1.558s
ok github.com/novox/mesh-host/internal/network 1.048s
ok github.com/novox/mesh-host/internal/outward 1.024s
ok github.com/novox/mesh-host/internal/profile 1.542s
ok github.com/novox/mesh-host/internal/reachable 1.017s
ok github.com/novox/mesh-host/internal/store 1.132s
ok github.com/novox/mesh-host/internal/system 1.018s
ok github.com/novox/mesh-host/internal/tunnel 1.021s
ok github.com/novox/mesh-host/internal/units 1.014s
ok github.com/novox/mesh-host/internal/upgrade 1.086s
ok github.com/novox/mesh-host/internal/witness 2.522s
ok github.com/novox/mesh-host/packaging 1.012s
? github.com/novox/mesh-host/rootsearch [no test files]
ok github.com/novox/mesh-host/validate 1.012s
```
mesh/merge-gate: PASS — every machine composes with the change as it did without (4 of 4 compose) (modules: mesh-host)
mesh/repo-check: PASS — its merge-check.sh passed
Delivery plan — builds mesh-host → ace, g14, novox, shanks; no bus step
tier 0: mesh-host
ace: receives mesh-host
g14: receives mesh-host
novox: receives mesh-host
shanks: receives mesh-host
grants step: if this changes what the bus's user list says (a new tool, subject or user), novox is sent that list alone, every build there kept, before mesh-host is judged on its first machine
read by no module's build: internal/apply/mesh_dirs_test.go, internal/apply/replay358_test.go
Run by the build seat on novox as build-1791804776583896111 (builds --log build-1791804776583896111).
--- the gate: mesh-host
mesh-host: ok
long-running resources without health: 0
files asking for a setting without saying whether it is trusted: 0
1 manifest(s) checked. Judged against the seats this binary carries; a claim on one of the mesh's own seats is judged fully at registration, and a seat declared by a module not given here reads as unknown. Identities judged on a 6-character machine name, against the bounds of the providers given here
judging 0 module(s) changed against 4 machine(s), as the snapshot of 2026-10-12T11:32:09Z says they run
composing every machine as the mesh is
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
composing every machine with the change
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
merge gate: PASS — every machine composes with the change as it did without (4 of 4 compose)
judged by controller development build against the facts of 2026-10-12T11:32:09Z
machines:
- a machine (f35): composes
- holds mesh-dns-resolver (idt): composes
- holds git, holds mesh-artifact-store, holds mesh-broker, holds mesh-catalog, holds mesh-delivery, holds mesh-dns-resolver, holds mesh-store, holds mesh-vault, holds npm-package-registry, the control node, the hub (ygcyr): composes
- a machine (yvbpsm): composes
a merge would rebuild 1 module(s) in 1 tier(s): mesh-host
notes:
- internal/apply/mesh_dirs_test.go and internal/apply/replay358_test.go read by no module's build, and rebuild nothing (issue 280)
--- its merge-check.sh (go toolchain)
ok github.com/novox/mesh-host/cmd/mesh-bootstrap 1.022s
ok github.com/novox/mesh-host/cmd/mesh-host 7.499s
ok github.com/novox/mesh-host/examples 1.021s
ok github.com/novox/mesh-host/internal/accounts 2.764s
ok github.com/novox/mesh-host/internal/apply 31.295s
ok github.com/novox/mesh-host/internal/bootstrap 3.000s
ok github.com/novox/mesh-host/internal/bundle 1.015s
ok github.com/novox/mesh-host/internal/declaration 1.059s
ok github.com/novox/mesh-host/internal/firewall 2.175s
ok github.com/novox/mesh-host/internal/identity 1.644s
ok github.com/novox/mesh-host/internal/image 1.016s
ok github.com/novox/mesh-host/internal/inventory 1.029s
ok github.com/novox/mesh-host/internal/link 10.540s
ok github.com/novox/mesh-host/internal/liveness 3.049s
ok github.com/novox/mesh-host/internal/meshcli 1.547s
ok github.com/novox/mesh-host/internal/network 1.050s
ok github.com/novox/mesh-host/internal/outward 1.020s
ok github.com/novox/mesh-host/internal/profile 1.494s
ok github.com/novox/mesh-host/internal/reachable 1.048s
ok github.com/novox/mesh-host/internal/store 2.535s
ok github.com/novox/mesh-host/internal/system 1.016s
ok github.com/novox/mesh-host/internal/tunnel 1.019s
ok github.com/novox/mesh-host/internal/units 1.009s
ok github.com/novox/mesh-host/internal/upgrade 2.166s
ok github.com/novox/mesh-host/internal/witness 37.398s
ok github.com/novox/mesh-host/packaging 1.067s
? github.com/novox/mesh-host/rootsearch [no test files]
ok github.com/novox/mesh-host/validate 1.012s
**Merge check** at `34a5aa57`
- `mesh/merge-gate`: **PASS** — every machine composes with the change as it did without (4 of 4 compose) (modules: mesh-host)
- `mesh/repo-check`: **PASS** — its merge-check.sh passed
**Delivery plan** — builds mesh-host → ace, g14, novox, shanks; no bus step
- tier 0: mesh-host
- ace: receives mesh-host
- g14: receives mesh-host
- novox: receives mesh-host
- shanks: receives mesh-host
- grants step: if this changes what the bus's user list says (a new tool, subject or user), novox is sent that list alone, every build there kept, before mesh-host is judged on its first machine
- read by no module's build: internal/apply/mesh_dirs_test.go, internal/apply/replay358_test.go
Run by the build seat on novox as `build-1791804776583896111` (`builds --log build-1791804776583896111`).
```
--- the gate: mesh-host
mesh-host: ok
long-running resources without health: 0
files asking for a setting without saying whether it is trusted: 0
1 manifest(s) checked. Judged against the seats this binary carries; a claim on one of the mesh's own seats is judged fully at registration, and a seat declared by a module not given here reads as unknown. Identities judged on a 6-character machine name, against the bounds of the providers given here
judging 0 module(s) changed against 4 machine(s), as the snapshot of 2026-10-12T11:32:09Z says they run
composing every machine as the mesh is
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
composing every machine with the change
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
merge gate: PASS — every machine composes with the change as it did without (4 of 4 compose)
judged by controller development build against the facts of 2026-10-12T11:32:09Z
machines:
- a machine (f35): composes
- holds mesh-dns-resolver (idt): composes
- holds git, holds mesh-artifact-store, holds mesh-broker, holds mesh-catalog, holds mesh-delivery, holds mesh-dns-resolver, holds mesh-store, holds mesh-vault, holds npm-package-registry, the control node, the hub (ygcyr): composes
- a machine (yvbpsm): composes
a merge would rebuild 1 module(s) in 1 tier(s): mesh-host
notes:
- internal/apply/mesh_dirs_test.go and internal/apply/replay358_test.go read by no module's build, and rebuild nothing (issue 280)
--- its merge-check.sh (go toolchain)
ok github.com/novox/mesh-host/cmd/mesh-bootstrap 1.022s
ok github.com/novox/mesh-host/cmd/mesh-host 7.499s
ok github.com/novox/mesh-host/examples 1.021s
ok github.com/novox/mesh-host/internal/accounts 2.764s
ok github.com/novox/mesh-host/internal/apply 31.295s
ok github.com/novox/mesh-host/internal/bootstrap 3.000s
ok github.com/novox/mesh-host/internal/bundle 1.015s
ok github.com/novox/mesh-host/internal/declaration 1.059s
ok github.com/novox/mesh-host/internal/firewall 2.175s
ok github.com/novox/mesh-host/internal/identity 1.644s
ok github.com/novox/mesh-host/internal/image 1.016s
ok github.com/novox/mesh-host/internal/inventory 1.029s
ok github.com/novox/mesh-host/internal/link 10.540s
ok github.com/novox/mesh-host/internal/liveness 3.049s
ok github.com/novox/mesh-host/internal/meshcli 1.547s
ok github.com/novox/mesh-host/internal/network 1.050s
ok github.com/novox/mesh-host/internal/outward 1.020s
ok github.com/novox/mesh-host/internal/profile 1.494s
ok github.com/novox/mesh-host/internal/reachable 1.048s
ok github.com/novox/mesh-host/internal/store 2.535s
ok github.com/novox/mesh-host/internal/system 1.016s
ok github.com/novox/mesh-host/internal/tunnel 1.019s
ok github.com/novox/mesh-host/internal/units 1.009s
ok github.com/novox/mesh-host/internal/upgrade 2.166s
ok github.com/novox/mesh-host/internal/witness 37.398s
ok github.com/novox/mesh-host/packaging 1.067s
? github.com/novox/mesh-host/rootsearch [no test files]
ok github.com/novox/mesh-host/validate 1.012s
```
Independent review of PR #87 (issue 358) at head 34a5aa57e806. I made a fresh clone, read the whole diff and applyDirectory around it, ran go vet, go test -race and ./merge-check.sh (all green), laid the replay over main, and ran probe tests of my own, which I did not commit.
Blocking: a link refusal does not gate its module, so root then writes the module's files through the link it just refused
The PR body says "a refused directory gates its own module, issue 495". That is not what the code does. The issue 495 gate (apply.go ~720) and the file guard (apply.go ~1043, belowRefused) read only in.refused, the map refusedPlaces computes before the apply starts. The new LinkInPathError → PlacementRefusedError comes back from the directory's applier during the apply, so it never reaches that map. The engine reports the directory as a plain failure, and the rest of the module is attempted.
I proved it with a probe test through Apply. The test declares mod.state at <tmp>/parent/state (with parent a link in /tmp, which every account may write) and mod.conf as a file at <tmp>/parent/state/x.conf. The result:
The engine refused mod.state as "is not placed … could replace … nothing was touched".
It then reported mod.conf created, and the file is in the link's target (<tmp>/elsewhere/state/x.conf).
The report says "everything was attempted, so what is not listed as failed was done".
This repeats the issue 495 incident (refuse, say nothing was touched, then write into it). It also leaves 358's own attack half open. Whoever can swap the parent cannot get root's chmod or chown on the directory any more, but still gets root writing the module's files, by path, into a place they chose.
Asked for:
When applyDirectory returns a PlacementRefusedError (at least a LinkInPathError), record it in in.refused and gate the module, exactly as for a refusal by the guard.
Make the file and archive guards also refuse anything below a directory refused during this apply, whatever module declares it (belowRefused against the map as it grows), so another module's file below it is not written either.
Add a test through Apply: a parent that is a link another account could replace, a directory below it, and a file below that. The file must not be written, the module must be reported gated, and the report must not say everything was attempted.
Rollout risk (this makes fix 1 urgent to judge before merge)
The last mesh-host walk (plan-1791804181657038622, #86) went to ace first and gated on ace alone ("healthy 3 times over 2m49s"). It then sent g14, novox and shanks together. The first-node gate therefore never looks at novox, the one machine not surveyed (123 directories, no read tool there). A refusal on novox would show only after it had already happened.
With the code as it stands, a refusal of /var/lib/mesh/mesh-controller on novox fails that one directory and nothing else. The controller keeps running, and the directory's mode and owner are no longer maintained. Availability is not at risk.
Once refusals gate the module (fix 1, which is needed), the same refusal would gate the mesh-controller module on the control-node, or the mesh-host module itself if one of its directories were refused. The mesh could then not deliver its own way out, and recovery would need a hand step at novox.
Recommendation: before merging, survey novox's declared directories with the node-engine's own judgement. Issue 358's decision note asks for exactly that ("a dry run or a tool"). For example, deliver first a read-only verb on the node-engine that runs openMeshDir's judgement without mkdir or chmod over the current declaration. Run it on all four nodes and put the list in this PR. If that cannot come first, the next best is to ask the operator for a terminal check of novox's parents. Do not merge on the ace gate alone.
Checked and fine
No path-based chmod, chown or stat is left on the write path for a directory outside every home. Mode and owner are set with Fchmod/Fchown on the walked descriptor, read back with Fstat, and every component is opened with O_DIRECTORY|O_NOFOLLOW. The Lstat and ownedBy before the branch are reads that only steer as-found. They cannot redirect the write, which still goes only through links root alone could have made.
The trust rule matches the decision: the link must be root's, and every directory from / down to the one holding it must be root's, with no other-write and no group-write unless the group is gid 0. A replacer above is carried down, so a writable ancestor refuses every link below it.
Relative links resolve against the physical at, and ../x/real works (probe). Lexical cleaning is safe because at contains no links. Small caveat: a target such as a/b/../c, where b is itself a link, is cleaned lexically, unlike the kernel. That is harmless, because the cleaned path is walked safely again.
/var/run → ../run: the walk follows it on this machine (probe of /var/run/systemd). /var/lock → ../run/lock is followed too. Mount points need nothing special with openat.
The 40-link limit holds: 40 links pass and 41 fail with ELOOP. In practice the earlier Lstat hits the kernel's own limit first.
Parents made inside the owner's home are given to the owner through their descriptors, as before.
Off Linux, meshDirsByDescriptor=false keeps the by-path code, and GOOS=darwin builds.
The replay TestAParentSwappedForALinkLeavesItsTargetUntouched fails on main ("not refused: ") and passes here.
go vet and go test -race (merge-check.sh) pass. #86 is merged (3f7f797) and is already in this branch's base (a76baa4), and git merge-tree against main is clean.
mesh/merge-gate passes (4 of 4 compose), and so does mesh/repo-check.
Non-blocking
After following a link, here == want no longer holds, so the walk itself would word a file at the declared name as "X is not a directory, and want lies below it". The earlier path-based Lstat catches this case first ("exists and is not a directory", probe), so the wording shows only in a race. Comparing against the walked path's last component would fix it.
created := made[last] == clean is false behind a link; !existed covers it, but compare against the walked path.
Out of scope, but the same class as this issue: files and archives outside homes are still written by path through parent links. Worth its own issue.
Verdict: request changes at 34a5aa5
Independent review of PR #87 (issue 358) at head 34a5aa57e806. I made a fresh clone, read the whole diff and applyDirectory around it, ran `go vet`, `go test -race` and `./merge-check.sh` (all green), laid the replay over main, and ran probe tests of my own, which I did not commit.
**Blocking: a link refusal does not gate its module, so root then writes the module's files through the link it just refused**
The PR body says "a refused directory gates its own module, issue 495". That is not what the code does. The issue 495 gate (apply.go ~720) and the file guard (apply.go ~1043, `belowRefused`) read only `in.refused`, the map `refusedPlaces` computes before the apply starts. The new `LinkInPathError` → `PlacementRefusedError` comes back from the directory's applier during the apply, so it never reaches that map. The engine reports the directory as a plain failure, and the rest of the module is attempted.
I proved it with a probe test through `Apply`. The test declares `mod.state` at `<tmp>/parent/state` (with `parent` a link in /tmp, which every account may write) and `mod.conf` as a file at `<tmp>/parent/state/x.conf`. The result:
- The engine refused `mod.state` as "is not placed … could replace … nothing was touched".
- It then reported `mod.conf created`, and the file is in the link's target (`<tmp>/elsewhere/state/x.conf`).
- The report says "everything was attempted, so what is not listed as failed was done".
This repeats the issue 495 incident (refuse, say nothing was touched, then write into it). It also leaves 358's own attack half open. Whoever can swap the parent cannot get root's chmod or chown on the directory any more, but still gets root writing the module's files, by path, into a place they chose.
Asked for:
1. When `applyDirectory` returns a `PlacementRefusedError` (at least a `LinkInPathError`), record it in `in.refused` and gate the module, exactly as for a refusal by the guard.
2. Make the file and archive guards also refuse anything below a directory refused during this apply, whatever module declares it (`belowRefused` against the map as it grows), so another module's file below it is not written either.
3. Add a test through `Apply`: a parent that is a link another account could replace, a directory below it, and a file below that. The file must not be written, the module must be reported gated, and the report must not say everything was attempted.
**Rollout risk (this makes fix 1 urgent to judge before merge)**
- The last mesh-host walk (plan-1791804181657038622, #86) went to **ace first** and gated on ace alone ("healthy 3 times over 2m49s"). It then sent g14, novox and shanks together. The first-node gate therefore never looks at novox, the one machine not surveyed (123 directories, no read tool there). A refusal on novox would show only after it had already happened.
- With the code as it stands, a refusal of /var/lib/mesh/mesh-controller on novox fails that one directory and nothing else. The controller keeps running, and the directory's mode and owner are no longer maintained. Availability is not at risk.
- Once refusals gate the module (fix 1, which is needed), the same refusal would gate the mesh-controller module on the control-node, or the mesh-host module itself if one of its directories were refused. The mesh could then not deliver its own way out, and recovery would need a hand step at novox.
- Recommendation: before merging, survey novox's declared directories with the node-engine's own judgement. Issue 358's decision note asks for exactly that ("a dry run or a tool"). For example, deliver first a read-only verb on the node-engine that runs `openMeshDir`'s judgement without mkdir or chmod over the current declaration. Run it on all four nodes and put the list in this PR. If that cannot come first, the next best is to ask the operator for a terminal check of novox's parents. Do not merge on the ace gate alone.
**Checked and fine**
- No path-based chmod, chown or stat is left on the write path for a directory outside every home. Mode and owner are set with `Fchmod`/`Fchown` on the walked descriptor, read back with `Fstat`, and every component is opened with `O_DIRECTORY|O_NOFOLLOW`. The `Lstat` and `ownedBy` before the branch are reads that only steer as-found. They cannot redirect the write, which still goes only through links root alone could have made.
- The trust rule matches the decision: the link must be root's, and every directory from / down to the one holding it must be root's, with no other-write and no group-write unless the group is gid 0. A replacer above is carried down, so a writable ancestor refuses every link below it.
- Relative links resolve against the physical `at`, and `../x/real` works (probe). Lexical cleaning is safe because `at` contains no links. Small caveat: a target such as `a/b/../c`, where `b` is itself a link, is cleaned lexically, unlike the kernel. That is harmless, because the cleaned path is walked safely again.
- /var/run → ../run: the walk follows it on this machine (probe of `/var/run/systemd`). /var/lock → ../run/lock is followed too. Mount points need nothing special with `openat`.
- The 40-link limit holds: 40 links pass and 41 fail with ELOOP. In practice the earlier `Lstat` hits the kernel's own limit first.
- Parents made inside the owner's home are given to the owner through their descriptors, as before.
- Off Linux, `meshDirsByDescriptor=false` keeps the by-path code, and GOOS=darwin builds.
- The replay `TestAParentSwappedForALinkLeavesItsTargetUntouched` fails on main ("not refused: <nil>") and passes here.
- `go vet` and `go test -race` (merge-check.sh) pass. #86 is merged (3f7f797) and is already in this branch's base (a76baa4), and `git merge-tree` against main is clean.
- mesh/merge-gate passes (4 of 4 compose), and so does mesh/repo-check.
**Non-blocking**
- After following a link, `here == want` no longer holds, so the walk itself would word a file at the declared name as "X is not a directory, and want lies below it". The earlier path-based `Lstat` catches this case first ("exists and is not a directory", probe), so the wording shows only in a race. Comparing against the walked path's last component would fix it.
- `created := made[last] == clean` is false behind a link; `!existed` covers it, but compare against the walked path.
- Out of scope, but the same class as this issue: files and archives outside homes are still written by path through parent links. Worth its own issue.
mesh/merge-gate pass: builds mesh-host → ace, g14, novox, shanks; no bus step; every machine composes with the change as it did without (4 of 4 compose)
Once a mesh directory's mode and owner go only through a walk that follows no
link another account could make, a directory behind such a link is refused
and its module gated: on the control-node that could stop the controller.
The operator is to be told which directories that walk would refuse on every
node before it lands. So the engine judges the declaration it keeps with the
same walk, making and changing nothing: on a signed ask from the controller
(mesh.node.<node>.ask.judge-directories, held to the hand-over's checks) and
as `nox-mesh-host judge-directories` at the machine.
mesh/merge-gate pass: builds mesh-host → ace, g14, novox, shanks; no bus step; every machine composes with the change as it did without (4 of 4 compose)
A mesh directory outside every home was chmodded and chowned by path, so a
parent turned into a link between two applies carried root's chmod and chown
to the link's target. It is now made and changed through the descriptor of
the walk from / that follows a link only root alone could have made.
A directory that walk refuses is a refusal like the placement guard's
(review 47): judged before anything is applied, and again when the
directory is applied, used as found or not; refused at either point it gates
its module and refuses what is below it, so no file is written into the
link's target and the report does not say everything was attempted.
mesh/merge-gate: PASS — every machine composes with the change as it did without (4 of 4 compose) (modules: mesh-host)
mesh/repo-check: PASS — its merge-check.sh passed
Delivery plan — builds mesh-host → ace, g14, novox, shanks; no bus step
tier 0: mesh-host
ace: receives mesh-host
g14: receives mesh-host
novox: receives mesh-host
shanks: receives mesh-host
grants step: if this changes what the bus's user list says (a new tool, subject or user), novox is sent that list alone, every build there kept, before mesh-host is judged on its first machine
read by no module's build: internal/apply/judge_directories_test.go, internal/apply/mesh_dirs_gate_test.go, internal/apply/mesh_dirs_test.go, internal/apply/replay358_test.go, internal/link/judge_directories_test.go
Run by the build seat on shanks as build-1791806474847557483 (builds --log build-1791806474847557483).
--- the gate: mesh-host
mesh-host: ok
long-running resources without health: 0
files asking for a setting without saying whether it is trusted: 0
1 manifest(s) checked. Judged against the seats this binary carries; a claim on one of the mesh's own seats is judged fully at registration, and a seat declared by a module not given here reads as unknown. Identities judged on a 6-character machine name, against the bounds of the providers given here
judging 0 module(s) changed against 4 machine(s), as the snapshot of 2026-10-12T12:01:38Z says they run
composing every machine as the mesh is
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
composing every machine with the change
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
merge gate: PASS — every machine composes with the change as it did without (4 of 4 compose)
judged by controller development build against the facts of 2026-10-12T12:01:38Z
machines:
- a machine (f35): composes
- holds mesh-dns-resolver (idt): composes
- holds git, holds mesh-artifact-store, holds mesh-broker, holds mesh-catalog, holds mesh-delivery, holds mesh-dns-resolver, holds mesh-store, holds mesh-vault, holds npm-package-registry, the control node, the hub (ygcyr): composes
- a machine (yvbpsm): composes
a merge would rebuild 1 module(s) in 1 tier(s): mesh-host
notes:
- internal/apply/judge_directories_test.go, internal/apply/mesh_dirs_gate_test.go, internal/apply/mesh_dirs_test.go, internal/apply/replay358_test.go and internal/link/judge_directories_test.go read by no module's build, and rebuild nothing (issue 280)
--- its merge-check.sh (go toolchain)
ok github.com/novox/mesh-host/cmd/mesh-bootstrap 1.012s
ok github.com/novox/mesh-host/cmd/mesh-host 5.654s
ok github.com/novox/mesh-host/examples 1.017s
ok github.com/novox/mesh-host/internal/accounts 1.555s
ok github.com/novox/mesh-host/internal/apply 5.001s
ok github.com/novox/mesh-host/internal/bootstrap 1.668s
ok github.com/novox/mesh-host/internal/bundle 1.055s
ok github.com/novox/mesh-host/internal/declaration 1.092s
ok github.com/novox/mesh-host/internal/firewall 1.907s
ok github.com/novox/mesh-host/internal/identity 1.135s
ok github.com/novox/mesh-host/internal/image 1.049s
ok github.com/novox/mesh-host/internal/inventory 1.054s
ok github.com/novox/mesh-host/internal/link 10.476s
ok github.com/novox/mesh-host/internal/liveness 2.133s
ok github.com/novox/mesh-host/internal/meshcli 1.583s
ok github.com/novox/mesh-host/internal/network 1.071s
ok github.com/novox/mesh-host/internal/outward 1.054s
ok github.com/novox/mesh-host/internal/profile 1.537s
ok github.com/novox/mesh-host/internal/reachable 1.045s
ok github.com/novox/mesh-host/internal/store 1.238s
ok github.com/novox/mesh-host/internal/system 1.055s
ok github.com/novox/mesh-host/internal/tunnel 1.047s
ok github.com/novox/mesh-host/internal/units 1.049s
ok github.com/novox/mesh-host/internal/upgrade 1.187s
ok github.com/novox/mesh-host/internal/witness 4.845s
ok github.com/novox/mesh-host/packaging 1.040s
? github.com/novox/mesh-host/rootsearch [no test files]
ok github.com/novox/mesh-host/validate 1.040s
**Merge check** at `e3c3bb37`
- `mesh/merge-gate`: **PASS** — every machine composes with the change as it did without (4 of 4 compose) (modules: mesh-host)
- `mesh/repo-check`: **PASS** — its merge-check.sh passed
**Delivery plan** — builds mesh-host → ace, g14, novox, shanks; no bus step
- tier 0: mesh-host
- ace: receives mesh-host
- g14: receives mesh-host
- novox: receives mesh-host
- shanks: receives mesh-host
- grants step: if this changes what the bus's user list says (a new tool, subject or user), novox is sent that list alone, every build there kept, before mesh-host is judged on its first machine
- read by no module's build: internal/apply/judge_directories_test.go, internal/apply/mesh_dirs_gate_test.go, internal/apply/mesh_dirs_test.go, internal/apply/replay358_test.go, internal/link/judge_directories_test.go
Run by the build seat on shanks as `build-1791806474847557483` (`builds --log build-1791806474847557483`).
```
--- the gate: mesh-host
mesh-host: ok
long-running resources without health: 0
files asking for a setting without saying whether it is trusted: 0
1 manifest(s) checked. Judged against the seats this binary carries; a claim on one of the mesh's own seats is judged fully at registration, and a seat declared by a module not given here reads as unknown. Identities judged on a 6-character machine name, against the bounds of the providers given here
judging 0 module(s) changed against 4 machine(s), as the snapshot of 2026-10-12T12:01:38Z says they run
composing every machine as the mesh is
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
composing every machine with the change
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
merge gate: PASS — every machine composes with the change as it did without (4 of 4 compose)
judged by controller development build against the facts of 2026-10-12T12:01:38Z
machines:
- a machine (f35): composes
- holds mesh-dns-resolver (idt): composes
- holds git, holds mesh-artifact-store, holds mesh-broker, holds mesh-catalog, holds mesh-delivery, holds mesh-dns-resolver, holds mesh-store, holds mesh-vault, holds npm-package-registry, the control node, the hub (ygcyr): composes
- a machine (yvbpsm): composes
a merge would rebuild 1 module(s) in 1 tier(s): mesh-host
notes:
- internal/apply/judge_directories_test.go, internal/apply/mesh_dirs_gate_test.go, internal/apply/mesh_dirs_test.go, internal/apply/replay358_test.go and internal/link/judge_directories_test.go read by no module's build, and rebuild nothing (issue 280)
--- its merge-check.sh (go toolchain)
ok github.com/novox/mesh-host/cmd/mesh-bootstrap 1.012s
ok github.com/novox/mesh-host/cmd/mesh-host 5.654s
ok github.com/novox/mesh-host/examples 1.017s
ok github.com/novox/mesh-host/internal/accounts 1.555s
ok github.com/novox/mesh-host/internal/apply 5.001s
ok github.com/novox/mesh-host/internal/bootstrap 1.668s
ok github.com/novox/mesh-host/internal/bundle 1.055s
ok github.com/novox/mesh-host/internal/declaration 1.092s
ok github.com/novox/mesh-host/internal/firewall 1.907s
ok github.com/novox/mesh-host/internal/identity 1.135s
ok github.com/novox/mesh-host/internal/image 1.049s
ok github.com/novox/mesh-host/internal/inventory 1.054s
ok github.com/novox/mesh-host/internal/link 10.476s
ok github.com/novox/mesh-host/internal/liveness 2.133s
ok github.com/novox/mesh-host/internal/meshcli 1.583s
ok github.com/novox/mesh-host/internal/network 1.071s
ok github.com/novox/mesh-host/internal/outward 1.054s
ok github.com/novox/mesh-host/internal/profile 1.537s
ok github.com/novox/mesh-host/internal/reachable 1.045s
ok github.com/novox/mesh-host/internal/store 1.238s
ok github.com/novox/mesh-host/internal/system 1.055s
ok github.com/novox/mesh-host/internal/tunnel 1.047s
ok github.com/novox/mesh-host/internal/units 1.049s
ok github.com/novox/mesh-host/internal/upgrade 1.187s
ok github.com/novox/mesh-host/internal/witness 4.845s
ok github.com/novox/mesh-host/packaging 1.040s
? github.com/novox/mesh-host/rootsearch [no test files]
ok github.com/novox/mesh-host/validate 1.040s
```
Re-review of PR #87 (issue 358) at head e3c3bb37d0, which is stacked on #88 (b92fb68). It answers review 47. I made a fresh clone and read the diff against #88 and applyDirectory and refusedPlaces around it. I ran go vet, go test -race ./... and ./merge-check.sh at this head (all green), and GOOS=darwin go build ./... builds.
Review 47's blocking finding: fixed
Refusal joins in.refused and gates the module. A PlacementRefusedError from applyDirectory is now recorded in in.refused before the issue-495 gate reads it (apply.go ~731). A directory used as found is now walked at use as well (judgeMeshDir before the as-found return), so a link refusal can no longer slip through as "used as found".
Below a refused directory, whatever module.refusedPlaces runs the walk's judgement before anything is applied, so a file or archive below it is refused by the existing belowRefused over the trees, in any declaration order. applyOne also checks belowRefused against in.refused as the map grows.
Test through Apply.mesh_dirs_gate_test.go covers both moments. I copied it onto the old head 34a5aa5, and both tests fail there.
I re-ran my probe with my own uncommitted test. The declaration put the file first, another module's file below the directory, another module's subdirectory below it, and the directory last. With the link present when the apply begins, all three are refused, nothing is written into the link's target, the target keeps mode 755, and the report says "the rest of mod, oth was not attempted". It no longer says everything was attempted.
No regression for handed-over directories or homes
Below a home, homeAbove != "" keeps ADR 0266's walk. Neither the pre-judgement nor applyMeshDirectory runs there.
A handed-over directory is excluded from both walks and keeps applyHandedOver (issue 356). The existing hand-over and home tests pass.
One behaviour change, which I think is intended: a PlacementRefusedError from the handed-over walk, or the issue-339 "is a symbolic link" refusal, now also gates its module and refuses what is below it. That is consistent with issue 495 and review 47.
Non-blocking: any error of the pre-judgement now counts as a refusal in refusedPlaces, not only a link. For example, a declared path whose parent is a regular file used to be a plain failure of that one directory, and now gates its module. That is stricter, not looser, but the operator sees a different report.
Non-blocking: the at-use refusal protects only what comes after it in declared order
The apply follows declared order (afterWhatTheyRead). In my probe, the link was judged trusted by the guard's walk and untrusted at use (the race the second test simulates). A file declared before its directory was written into the link's target before the directory was walked. In the PR's test, the directory comes first, so it passes. This needs a swap during one apply, and it is the same class as the out-of-scope point in review 47: files are still written by path through parent links. Worth recording on that follow-up issue. It is not a regression, because main writes those files the same way.
Checks: mesh/merge-gate pass (4 of 4 compose) and mesh/repo-check pass at e3c3bb3.
Merge condition (from the body and review 47, not a code finding): merge only after #88 is merged and delivered, and only once its judgement from all four nodes, novox included, is in this body in place of the stat survey. The controller's sending verb is not built yet, so novox's list needs nox-mesh-host judge-directories run as root at novox's terminal. Any would be refused line for a mesh-controller or mesh-host directory on novox is a stop, because this PR would gate that module.
Verdict: approve at e3c3bb3
Re-review of PR #87 (issue 358) at head e3c3bb37d0cd, which is stacked on #88 (b92fb68). It answers review 47. I made a fresh clone and read the diff against #88 and `applyDirectory` and `refusedPlaces` around it. I ran `go vet`, `go test -race ./...` and `./merge-check.sh` at this head (all green), and `GOOS=darwin go build ./...` builds.
**Review 47's blocking finding: fixed**
1. *Refusal joins `in.refused` and gates the module.* A `PlacementRefusedError` from `applyDirectory` is now recorded in `in.refused` before the issue-495 gate reads it (apply.go ~731). A directory used as found is now walked at use as well (`judgeMeshDir` before the as-found return), so a link refusal can no longer slip through as "used as found".
2. *Below a refused directory, whatever module.* `refusedPlaces` runs the walk's judgement before anything is applied, so a file or archive below it is refused by the existing `belowRefused` over the trees, in any declaration order. `applyOne` also checks `belowRefused` against `in.refused` as the map grows.
3. *Test through `Apply`.* `mesh_dirs_gate_test.go` covers both moments. I copied it onto the old head 34a5aa5, and both tests fail there.
I re-ran my probe with my own uncommitted test. The declaration put the file first, another module's file below the directory, another module's subdirectory below it, and the directory last. With the link present when the apply begins, all three are refused, nothing is written into the link's target, the target keeps mode 755, and the report says "the rest of mod, oth was not attempted". It no longer says everything was attempted.
**No regression for handed-over directories or homes**
- Below a home, `homeAbove != ""` keeps ADR 0266's walk. Neither the pre-judgement nor `applyMeshDirectory` runs there.
- A handed-over directory is excluded from both walks and keeps `applyHandedOver` (issue 356). The existing hand-over and home tests pass.
- One behaviour change, which I think is intended: a `PlacementRefusedError` from the handed-over walk, or the issue-339 "is a symbolic link" refusal, now also gates its module and refuses what is below it. That is consistent with issue 495 and review 47.
- Non-blocking: any error of the pre-judgement now counts as a refusal in `refusedPlaces`, not only a link. For example, a declared path whose parent is a regular file used to be a plain failure of that one directory, and now gates its module. That is stricter, not looser, but the operator sees a different report.
**Non-blocking: the at-use refusal protects only what comes after it in declared order**
The apply follows declared order (`afterWhatTheyRead`). In my probe, the link was judged trusted by the guard's walk and untrusted at use (the race the second test simulates). A file declared *before* its directory was written into the link's target before the directory was walked. In the PR's test, the directory comes first, so it passes. This needs a swap during one apply, and it is the same class as the out-of-scope point in review 47: files are still written by path through parent links. Worth recording on that follow-up issue. It is not a regression, because main writes those files the same way.
**Checks**: mesh/merge-gate pass (4 of 4 compose) and mesh/repo-check pass at e3c3bb3.
**Merge condition (from the body and review 47, not a code finding)**: merge only after #88 is merged and delivered, and only once its judgement from all four nodes, novox included, is in this body in place of the stat survey. The controller's sending verb is not built yet, so novox's list needs `nox-mesh-host judge-directories` run as root at novox's terminal. Any `would be refused` line for a mesh-controller or mesh-host directory on novox is a stop, because this PR would gate that module.
Survey before merge, run 2026-10-12 ~15:15 local with the delivered read-only judgement (mesh-host #88 + mesh-controller #258), mesh-controller.judge-directories per node:
novox: 123 declared, 118 placed, 0 would be refused, 0 refused by the placement guard, 5 below a home (incl. /var/lib/mesh/mesh-controller placed)
ace: 162 declared, 157 placed, 0 would be refused, 0 refused by the guard, 5 below a home
shanks: 48 declared, 32 placed, 0 would be refused, 0 refused by the guard, 16 below a home
g14: 53 declared, 38 placed, 0 would be refused, 0 refused by the guard, 15 below a home
So merging this refuses no declared directory on any node today (review 50's condition met).
Survey before merge, run 2026-10-12 ~15:15 local with the delivered read-only judgement (mesh-host #88 + mesh-controller #258), `mesh-controller.judge-directories` per node:
- novox: 123 declared, 118 placed, **0 would be refused**, 0 refused by the placement guard, 5 below a home (incl. /var/lib/mesh/mesh-controller placed)
- ace: 162 declared, 157 placed, **0 would be refused**, 0 refused by the guard, 5 below a home
- shanks: 48 declared, 32 placed, **0 would be refused**, 0 refused by the guard, 16 below a home
- g14: 53 declared, 38 placed, **0 would be refused**, 0 refused by the guard, 15 below a home
So merging this refuses no declared directory on any node today (review 50's condition met).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Do not merge before #88 (the read-only judgement), which this branch is stacked on. #88 merges and delivers first, it is run on all four nodes, and that list replaces the survey below.
Why (issue 358, decided on the issue 2026-10-11). A mesh directory outside every home was given its mode and owner by path (
os.Chmod,os.ChowninapplyDirectoryviachmodDirPathandown), which follow a link anywhere in the path. Whoever could turn a parent into a link between two applies directed root's chmod and chown at the link's target.What changes (the node-engine; the walk itself is #88's)
openMeshDir,mesh_dirs_apply_linux.go): from/,O_DIRECTORY|O_NOFOLLOWper component,mkdiratin the parent's descriptor,fchmod/fchownon the descriptor, read back from it. Parents it makes inside the owner's home are given to the owner through their descriptors (ADR 0182). A parent link is followed only when root alone could have made it: the link is root's, and every directory from/to it is root's and writable by no other account.refusedPlaces, so it gates its module and refuses what is below it whatever the declaration order.in.refused. It gates its module (the issue-495 gate), and applyOne's guard refuses a file or archive below it (belowRefusedoverin.refused).createdand the error text now compare against the path the walk reached, not the path declared (review 47, non-blocking).How it was tested
mesh_dirs_gate_test.go(review 47's probe, throughApply):replay358_test.go(the replay, uses only what main had): a parent swapped for a link after an apply; the target keeps mode 755. It fails on main.mesh_dirs_test.go:./merge-check.shgreen (bus tests skipped, no nats-server here). No test runs as root, so no test exercisesfchownto another account.Survey so far (2026-10-12, by
statandreadlinkof every path component; superseded by #88's judgement once delivered):/var/run -> ../run, root's, in root's/varand/.Replay: R358, to register in mesh-lab after merge:
InRepository, mesh-host,./internal/apply,TestAParentSwappedForALinkLeavesItsTargetUntouched,internal/apply/replay358_test.go.Fixes issue 358.
Delivery
novox/mesh-host@e3c3bb37d0cd— delivered since 2026-10-12T13:17:38ZDelivery plan — builds mesh-host → ace, g14, novox, shanks; no bus step
Machines
Transitions
The commit's note under
refs/notes/mesh-plankeeps every transition:git log --notes=mesh-plan.Merge check at
df7e47e1mesh/merge-gate: PASS — every machine composes with the change as it did without (4 of 4 compose) (modules: mesh-host)mesh/repo-check: PASS — its merge-check.sh passedDelivery plan — builds mesh-host → ace, g14, novox, shanks; no bus step
Run by the build seat on g14 as
build-1791804712871957557(builds --log build-1791804712871957557).Merge check at
34a5aa57mesh/merge-gate: PASS — every machine composes with the change as it did without (4 of 4 compose) (modules: mesh-host)mesh/repo-check: PASS — its merge-check.sh passedDelivery plan — builds mesh-host → ace, g14, novox, shanks; no bus step
Run by the build seat on novox as
build-1791804776583896111(builds --log build-1791804776583896111).Verdict: request changes at 34a5aa5
Independent review of PR #87 (issue 358) at head 34a5aa57e806. I made a fresh clone, read the whole diff and applyDirectory around it, ran
go vet,go test -raceand./merge-check.sh(all green), laid the replay over main, and ran probe tests of my own, which I did not commit.Blocking: a link refusal does not gate its module, so root then writes the module's files through the link it just refused
The PR body says "a refused directory gates its own module, issue 495". That is not what the code does. The issue 495 gate (apply.go ~720) and the file guard (apply.go ~1043,
belowRefused) read onlyin.refused, the maprefusedPlacescomputes before the apply starts. The newLinkInPathError→PlacementRefusedErrorcomes back from the directory's applier during the apply, so it never reaches that map. The engine reports the directory as a plain failure, and the rest of the module is attempted.I proved it with a probe test through
Apply. The test declaresmod.stateat<tmp>/parent/state(withparenta link in /tmp, which every account may write) andmod.confas a file at<tmp>/parent/state/x.conf. The result:mod.stateas "is not placed … could replace … nothing was touched".mod.conf created, and the file is in the link's target (<tmp>/elsewhere/state/x.conf).This repeats the issue 495 incident (refuse, say nothing was touched, then write into it). It also leaves 358's own attack half open. Whoever can swap the parent cannot get root's chmod or chown on the directory any more, but still gets root writing the module's files, by path, into a place they chose.
Asked for:
applyDirectoryreturns aPlacementRefusedError(at least aLinkInPathError), record it inin.refusedand gate the module, exactly as for a refusal by the guard.belowRefusedagainst the map as it grows), so another module's file below it is not written either.Apply: a parent that is a link another account could replace, a directory below it, and a file below that. The file must not be written, the module must be reported gated, and the report must not say everything was attempted.Rollout risk (this makes fix 1 urgent to judge before merge)
openMeshDir's judgement without mkdir or chmod over the current declaration. Run it on all four nodes and put the list in this PR. If that cannot come first, the next best is to ask the operator for a terminal check of novox's parents. Do not merge on the ace gate alone.Checked and fine
Fchmod/Fchownon the walked descriptor, read back withFstat, and every component is opened withO_DIRECTORY|O_NOFOLLOW. TheLstatandownedBybefore the branch are reads that only steer as-found. They cannot redirect the write, which still goes only through links root alone could have made.at, and../x/realworks (probe). Lexical cleaning is safe becauseatcontains no links. Small caveat: a target such asa/b/../c, wherebis itself a link, is cleaned lexically, unlike the kernel. That is harmless, because the cleaned path is walked safely again./var/run/systemd). /var/lock → ../run/lock is followed too. Mount points need nothing special withopenat.Lstathits the kernel's own limit first.meshDirsByDescriptor=falsekeeps the by-path code, and GOOS=darwin builds.TestAParentSwappedForALinkLeavesItsTargetUntouchedfails on main ("not refused: ") and passes here.go vetandgo test -race(merge-check.sh) pass. #86 is merged (3f7f797) and is already in this branch's base (a76baa4), andgit merge-treeagainst main is clean.Non-blocking
here == wantno longer holds, so the walk itself would word a file at the declared name as "X is not a directory, and want lies below it". The earlier path-basedLstatcatches this case first ("exists and is not a directory", probe), so the wording shows only in a race. Comparing against the walked path's last component would fix it.created := made[last] == cleanis false behind a link;!existedcovers it, but compare against the walked path.34a5aa57e8toe3c3bb37d0Merge check at
e3c3bb37mesh/merge-gate: PASS — every machine composes with the change as it did without (4 of 4 compose) (modules: mesh-host)mesh/repo-check: PASS — its merge-check.sh passedDelivery plan — builds mesh-host → ace, g14, novox, shanks; no bus step
Run by the build seat on shanks as
build-1791806474847557483(builds --log build-1791806474847557483).Verdict: approve at
e3c3bb3Re-review of PR #87 (issue 358) at head
e3c3bb37d0, which is stacked on #88 (b92fb68). It answers review 47. I made a fresh clone and read the diff against #88 andapplyDirectoryandrefusedPlacesaround it. I rango vet,go test -race ./...and./merge-check.shat this head (all green), andGOOS=darwin go build ./...builds.Review 47's blocking finding: fixed
in.refusedand gates the module. APlacementRefusedErrorfromapplyDirectoryis now recorded inin.refusedbefore the issue-495 gate reads it (apply.go ~731). A directory used as found is now walked at use as well (judgeMeshDirbefore the as-found return), so a link refusal can no longer slip through as "used as found".refusedPlacesruns the walk's judgement before anything is applied, so a file or archive below it is refused by the existingbelowRefusedover the trees, in any declaration order.applyOnealso checksbelowRefusedagainstin.refusedas the map grows.Apply.mesh_dirs_gate_test.gocovers both moments. I copied it onto the old head 34a5aa5, and both tests fail there.I re-ran my probe with my own uncommitted test. The declaration put the file first, another module's file below the directory, another module's subdirectory below it, and the directory last. With the link present when the apply begins, all three are refused, nothing is written into the link's target, the target keeps mode 755, and the report says "the rest of mod, oth was not attempted". It no longer says everything was attempted.
No regression for handed-over directories or homes
homeAbove != ""keeps ADR 0266's walk. Neither the pre-judgement norapplyMeshDirectoryruns there.applyHandedOver(issue 356). The existing hand-over and home tests pass.PlacementRefusedErrorfrom the handed-over walk, or the issue-339 "is a symbolic link" refusal, now also gates its module and refuses what is below it. That is consistent with issue 495 and review 47.refusedPlaces, not only a link. For example, a declared path whose parent is a regular file used to be a plain failure of that one directory, and now gates its module. That is stricter, not looser, but the operator sees a different report.Non-blocking: the at-use refusal protects only what comes after it in declared order
The apply follows declared order (
afterWhatTheyRead). In my probe, the link was judged trusted by the guard's walk and untrusted at use (the race the second test simulates). A file declared before its directory was written into the link's target before the directory was walked. In the PR's test, the directory comes first, so it passes. This needs a swap during one apply, and it is the same class as the out-of-scope point in review 47: files are still written by path through parent links. Worth recording on that follow-up issue. It is not a regression, because main writes those files the same way.Checks: mesh/merge-gate pass (4 of 4 compose) and mesh/repo-check pass at
e3c3bb3.Merge condition (from the body and review 47, not a code finding): merge only after #88 is merged and delivered, and only once its judgement from all four nodes, novox included, is in this body in place of the stat survey. The controller's sending verb is not built yet, so novox's list needs
nox-mesh-host judge-directoriesrun as root at novox's terminal. Anywould be refusedline for a mesh-controller or mesh-host directory on novox is a stop, because this PR would gate that module.Survey before merge, run 2026-10-12 ~15:15 local with the delivered read-only judgement (mesh-host #88 + mesh-controller #258),
mesh-controller.judge-directoriesper node:So merging this refuses no declared directory on any node today (review 50's condition met).