mind-body: the binary restricts its umask; the writer refuses unsafe installs

Soul s2: under a permissive umask the store was group/world-writable between
CultCache's rename and the chmod, and an fd opened there survived it. The
mind-control binary now sets umask 077 first (the library never touches the
umask). The writer refuses to write through an existing directory, lock or store
that is not root's or is group/world-writable, with the typed UnsafeStore error
naming path, mode and owner. Tests: a non-root open-for-write probe against the
real binary under umask 000; refusals for 0777/0775 directories, 0666/0664
locks and stores, and a non-root-owned directory; accepted root installs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-09 16:39:19 +02:00
commit 5cccab6899
6 changed files with 231 additions and 12 deletions

1
Cargo.lock generated
View file

@ -832,6 +832,7 @@ dependencies = [
"chrono",
"cultcache-rs",
"eureka-pipeline",
"libc",
"rust_decimal",
"serde",
"tempfile",