Skip to content

Commit 16b2ecf

Browse files
committed
Add SASL test to ensure that client password is a string
1 parent 3e34816 commit 16b2ecf

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: packages/pg/test/unit/client/sasl-scram-tests.js

+20
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,26 @@ test('sasl/scram', function () {
8080
)
8181
})
8282

83+
test('fails when client password is not a string', function () {
84+
for(const badPasswordValue of [null, undefined, 123, new Date(), {}]) {
85+
assert.throws(
86+
function () {
87+
sasl.continueSession(
88+
{
89+
message: 'SASLInitialResponse',
90+
clientNonce: 'a',
91+
},
92+
badPasswordValue,
93+
'r=1,i=1'
94+
)
95+
},
96+
{
97+
message: 'SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string',
98+
}
99+
)
100+
}
101+
})
102+
83103
test('fails when iteration is missing in server message', function () {
84104
assert.throws(
85105
function () {

0 commit comments

Comments
 (0)