Unverified Commit 4b300505 authored by NGPixel's avatar NGPixel

fix: prevent user enumeration using local login timings

parent 665284bf
const bcrypt = require('bcryptjs-then')
/* global WIKI */ /* global WIKI */
// ------------------------------------ // ------------------------------------
...@@ -28,6 +30,9 @@ module.exports = { ...@@ -28,6 +30,9 @@ module.exports = {
done(null, user) done(null, user)
} }
} else { } else {
// Fake verify password to mask timing differences
await bcrypt.compare((Math.random() + 1).toString(36), '$2a$12$irXbAcQSY59pcQQfNQpY8uyhfSw48nzDikAmr60drI501nR.PuBx2')
done(new WIKI.Error.AuthLoginFailed(), null) done(new WIKI.Error.AuthLoginFailed(), null)
} }
} catch (err) { } catch (err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment