Bug: GetDefaultStateDir ignores UserHomeDir error, may use empty path #14
Reference in New Issue
Block a user
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.