security: multi_user_add leaves user homes and secrets.toml world-readable #107
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_skills#107
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Newly-provisioned user homes have default umask permissions (
755/644) on sensitive files. In particular:~/hero/code/secrets/secrets.toml— world-readable (644) with forge tokens, LLM API keys, DB passwords, SMTP creds~/hero/cfg/hero_cfg.toml— explicitlychmod 644inbridge_save_state(less sensitive: mycelium bridge name + prefix, but still exposes topology)cd /home/<someone>and browseSampled on a live host: 13 users'
secrets.tomlreadable cross-user via:Location
tools/modules/installers/multiuser.nu—multi_user_addchowns the home to the user but neverchmods it down. The only paths explicitly tightened are SSH-related (~/.ssh/*). Home and~/hero/code/secrets/*inherit755/644from the btrfs template snapshot.bridge_save_state(line 127) explicitly sets~/hero/cfg/hero_cfg.tomlto644.Proposed fix
In
multi_user_add, after the snapshot + chown step, add:Also in
bridge_save_state: change the explicitchmod 644onhero_cfg.tomltochmod 600. Only the user's own tools and processes read it; no reason for it to be world-readable.Verification
After patching, on a freshly-provisioned user:
ls -ld ~→drwx------ls -l ~/hero/code/secrets/secrets.toml→-rw-------ls -l ~/hero/cfg/hero_cfg.toml→-rw-------Permission deniedon/home/<user>/hero/code/secrets/.Impact
High, systemic. Every user ever provisioned on a multi-user host has had their secrets cross-user-readable by default. Recommended follow-up: notify affected users, ask them to rotate anything sensitive in
secrets.tomland runchmod 700 ~themselves.