-
Notifications
You must be signed in to change notification settings - Fork 6.2k
fix: use sufficient computational effort for password hash #3422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
dd2cb16
cac6673
17be8c5
f35120c
aaf0447
fc3326f
dc2db5c
51f8341
70197bb
fd3cb6c
fcc3f0d
0cdbd33
91303d4
1134780
788b958
ffa5c16
7ff4117
a14ea39
409b473
6020480
923761c
517aaf7
531b7c0
8c2bb61
deaa224
3b50bfc
1e55a64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
This adds the proper await logic for the hashing of passwords.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,12 @@ router.post("/", async (req, res) => { | |
? isHashLegacyMatch(req.body.password, req.args["hashed-password"]) | ||
: req.args.password && safeCompare(req.body.password, req.args.password) | ||
) { | ||
const hashedPassword = req.args["hashed-password"] ? hashLegacy(req.body.password) : hash(req.body.password) | ||
// NOTE@jsjoeio: | ||
// We store the hashed password as a cookie. In order to be backwards-comptabile for the folks | ||
// using sha256 (the original hashing algorithm), we need to check the hashed-password in the req.args | ||
// TODO all of this logic should be cleaned up honestly. The current implementation only checks for a hashed-password | ||
// but doesn't check which algorithm they are using. | ||
const hashedPassword = req.args["hashed-password"] ? hashLegacy(req.body.password) : await hash(req.body.password) | ||
// The hash does not add any actual security but we do it for | ||
// obfuscation purposes (and as a side effect it handles escaping). | ||
res.cookie(Cookie.Key, hashedPassword, { | ||
|
||
|