Skip to content

Commit 74133e6

Browse files
authored
Merge pull request #1759 from nodeSolidServer/fix/issue#1758
fix security issue
2 parents 7ae2bcc + 89b5f13 commit 74133e6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/models/authenticator.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ class PasswordAuthenticator extends Authenticator {
140140
})
141141
.then(foundUser => {
142142
if (!foundUser) {
143-
error = new Error('No user found for that username')
143+
// CWE - CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (4.13)
144+
// https://cwe.mitre.org/data/definitions/200.html
145+
error = new Error('Invalid username/password combination.') // no detail for security 'No user found for that username')
144146
error.statusCode = 400
145147
throw error
146148
}
@@ -151,7 +153,9 @@ class PasswordAuthenticator extends Authenticator {
151153
})
152154
.then(validUser => {
153155
if (!validUser) {
154-
error = new Error('User found but no password match')
156+
// CWE - CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (4.13)
157+
// https://cwe.mitre.org/data/definitions/200.html
158+
error = new Error('Invalid username/password combination.') // no detail for security 'User found but no password match')
155159
error.statusCode = 400
156160
throw error
157161
}

test/unit/password-authenticator-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe('PasswordAuthenticator', () => {
9090
pwAuth.findValidUser()
9191
.catch(error => {
9292
expect(error.statusCode).to.equal(400)
93-
expect(error.message).to.equal('No user found for that username')
93+
expect(error.message).to.equal('Invalid username/password combination.')
9494
done()
9595
})
9696
})
@@ -111,7 +111,7 @@ describe('PasswordAuthenticator', () => {
111111
pwAuth.findValidUser()
112112
.catch(error => {
113113
expect(error.statusCode).to.equal(400)
114-
expect(error.message).to.equal('User found but no password match')
114+
expect(error.message).to.equal('Invalid username/password combination.')
115115
done()
116116
})
117117
})

0 commit comments

Comments
 (0)