Bug: GetDefaultStateDir ignores UserHomeDir error, may use empty path #14
Labels
No Label
merge-ready
merge-ready
needs-checks
needs-checks
needs-rebase
needs-rebase
needs-review
needs-review
needs-rework
needs-rework
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/secret#14
Loading…
Reference in New Issue
Block a user
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
internal/secret/helpers.go:50falls back toos.UserHomeDir()whenos.UserConfigDir()fails, but discards the error with_ =. If both calls fail,homeDiris empty string, producing a path like/.config/berlin.sneak.secretwhich is a root-level directory.Impact
On systems where neither config dir nor home dir is available (containers, restricted users), the tool would attempt to write to the root filesystem.
Fix
Return an error when both
os.UserConfigDir()andos.UserHomeDir()fail.Location
internal/secret/helpers.goline 50Fix submitted in PR #18.