Skip to content

fix(hosts): normalize the Rust tree before its receipt is written - #45

Merged
rldyourmnd merged 2 commits into
mainfrom
fix/rust-tree-permissions
Aug 3, 2026
Merged

fix(hosts): normalize the Rust tree before its receipt is written#45
rldyourmnd merged 2 commits into
mainfrom
fix/rust-tree-permissions

Conversation

@rldyourmnd

Copy link
Copy Markdown
Contributor

Found by auditing the machine after the 2.4.0 apply.

The published Rust tree root was 0775. Its bundled install.sh creates the prefix under the caller's umask, so umask 002 leaves it group-writable. Go and Node avoid this only because their trees come from mktemp -d at 0700 - luck, not a guarantee.

The receipt covers five executables (rustc, cargo, rust-analyzer, rustfmt, clippy-driver), so a writable directory beside them is enough to add a library without invalidating it. Same reasoning as the Dart tree in #43, same shared helper, applied before the receipt is written.

Deliberately not changed

Node's npm/npx/corepack entries match find -perm /022 but are symlinks, whose mode bits Linux ignores. The shared helper skips symlinks after checking containment, so it is correctly a no-op there. Go's tree measured 0 group-writable paths. Neither needed a change, and adding one would be noise.

Evidence

Measured on the reporting host, before and after running the same helper the installer now invokes:

before: 1 group-writable path  (drwxrwxr-x .../rust/1.97.1)
after:  0                      rustc 1.97.1 still resolves
Check Result
python3 -m pytest 96 passed (+1 invariant: normalize must precede the receipt)
scripts/ci/validate.sh / lint.sh ci-validate-ok / scripts-lint-ok

Found by auditing the machine after the 2.4.0 apply: the published Rust tree root
was 0775. Its bundled install.sh creates the prefix under the caller's umask, so
`umask 002` leaves it group-writable. Go and Node avoid this only because their
trees come from `mktemp -d` at 0700 - luck, not a guarantee.

The receipt covers five executables, so a writable directory beside them is enough
to add a library without invalidating it. Same reasoning as the Dart tree, same
shared helper, applied before the receipt is written.

Node's npm/npx/corepack entries match `find -perm /022` but are symlinks, whose
mode bits Linux ignores; the shared helper skips symlinks after checking
containment, so it is correctly a no-op there. No change was needed for Go or Node.
@rldyourmnd
rldyourmnd merged commit 57761cd into main Aug 3, 2026
29 checks passed
@rldyourmnd
rldyourmnd deleted the fix/rust-tree-permissions branch August 3, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant