-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Shell
-
None
-
ALL
I was trying to connect to a mongod with a password that happens to contain special characters. These special characters are supposed to be URL-encoded in the connection URI. For example, if the password is pass%word the connection URI should be mongodb://root:pass%25word@localhost:27017/test.
Using db.auth shows that the password contains a special character:
/tmp/repro % mongo MongoDB shell version: 3.2.10 connecting to: test > db.auth('root', 'pass%word') 1 > bye
The shell accepts this incorrect connection URI:
/tmp/repro % mongo 'mongodb://root:pass%word@localhost:27017/test' MongoDB shell version: 3.2.10 connecting to: mongodb://root:pass%word@localhost:27017/test > bye
The shell does not accept this correct connection URI:
/tmp/repro % mongo 'mongodb://root:pass%25word@localhost:27017/test' MongoDB shell version: 3.2.10 connecting to: mongodb://root:pass%25word@localhost:27017/test 2016-10-11T17:43:25.421-0400 E QUERY [thread1] Error: Authentication failed. : connect@src/mongo/shell/mongo.js:223:14 @(connect):1:6 exception: connect failed
Relevant part of the connection URI spec:
4. Validate, split (if applicable), and URL decode the user information.