Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Couple comments upon looking at the actual code:

- You can promisify randomBytes once and reuse it rather than twice for every invocation

- There shouldn’t be a default value for the company name or people will end up using it.

- The company name isn’t validated so it could contain underscores which would cause issues with the short token parsing as it assumes it’s the second “chunk”

- The equals comparison of the hashes for the secrets is not timing safe. It’s not as bad as if they were plain text but it does short circuit due to how string equals works. Use the actual built in timing safe equals on the Buffer hash (not the stringified hex).



thanks for taking a look! I've created an issue on the repo and should be able to address these tonight :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: