Skip to content

Hackage credentials file is world-readable when saved #2159

@nh2

Description

@nh2

saveCreds (

saveCreds :: Config -> HackageCreds -> IO ()
) creates ~/.stack/upload/credentials.json (containing Hackage username and password) without explicit file permissions, which results in the default umask being used, which is typically rw-rw-r, e.g. on Ubuntu.

This means that when your home directory is also world-readable (on Ubuntu it is, rwxr-xr-x), other users can grab your Hackage credentials.

For single user systems this is less problematic but not ideal for e.g. university setups where all users' homes are mounted over NFS.

The fix would be for stack to create this file with rw------- permissions (and ideally check this when reading so that upgrades from old versions of stack can notice the problem).

Independently, as a person who generally dislikes any on-disk plaintext passwords, I'd prefer if the default behaviour was not to save the credentials on disk, but use a flag for that.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions