by whatl3y · 6y ago · 0 comments
- for your second point, if you want to fork this repo and use another algo, go for it. if you install the package from npm and use it or clone and install from source without changing it, it uses the default AES256
- this could be argued as a valid point, and maybe forcing the user to use 32 bytes as their password is the right way to do it, but no 3rd party password manager forces this limitation so i don’t believe I should? Maybe just forcing a password difficulty is the right way to go? I’m certainly open to ideas, this is just a small project i enjoyed building and feel like the minimum security requirements to meet my needs are there.
[0]: https://github.com/whatl3y/hide/blob/1c3aaca634f504c3c274bac...
- no, you accept the algorithm as an environment variable - someone can install your package as is and still set it themselves
- as kohtatsu mentioned you should be using a key derivation function.
[0]: https://github.com/whatl3y/hide/blob/1c3aaca634f504c3c274bac...
- Got it, yeah I guess my defense would be it still requires the user to make a conscious decision so it’s not as bad as it being ambiguous or unclear, although removing the ability to control this via env var might be the right move.
- I’ll look into and add something to do this soon :)
I simply append the password to itself to get 32 bytes, but SHA256 is almost certainly the better/right way. Will add a PR this weekend.
---
(I apologize in advance. I don't typically make comments like this on HN but I feel it really is warranted here.)
Key Derivative Functions (KDFs) have already been mentioned here in the comments.
By not using one -- and, perhaps more importantly, by 1) not even understanding why you should use one and 2) thinking that one round of SHA256 is what you "should" do -- well, to be blunt, your project just screams out "hacked together piece of shit made by someone who has absolutely zero business whatsoever making a password manager".
---
"Show HN"'s are to get feedback. As it stands, your project should not be used -- by pretty much anyone! It doesn't have to stay that way, though. Please take some of the good advice you've gotten in the comments here and improve your project so that it can safely be used.
Nonetheless I appreciate the last bullet as I definitely post to Show HN to learn and get better as a developer, and certainly expect nothing less than to receive a few “fuck your shitty project”s along the way :)