Skip to content
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

Can't authenticate with a blank (empty string) password #133

Closed
dlongley opened this issue Nov 28, 2014 · 1 comment
Closed

Can't authenticate with a blank (empty string) password #133

dlongley opened this issue Nov 28, 2014 · 1 comment

Comments

@dlongley
Copy link

The following check causes authentication with a blank password to be skipped resulting in a 'Error setting TTL index on collection' error when later trying to ensure the indexes exist. This occurs on mongodb configurations that require strict authentication. This was noticed in a dev environment where the password used was just the empty string ('').

        if (options.username && options.password) {
          db.authenticate(options.username, options.password, function () {
            self._get_collection(cb);
          });
        } else {
          self._get_collection(cb);

https://github.com/kcbanner/connect-mongo/blob/master/lib/connect-mongo.js#L181

Perhaps the fix is simply:

        if (options.username && 'password' in options) {

But I'm not sure how much more comprehensive that check needs to be in this lib.

@dlongley
Copy link
Author

It might also be useful to print out the actual error that occurs when ensureIndex fails as we first thought this was related to the race condition described in other issues (#65, #70, #80).

jdesboeufs added a commit that referenced this issue Dec 24, 2014
* Re-use existing or upcoming mongoose connection
* Re-use existing or upcoming node-mongodb-native connection
* Accept full-featured MongoDB connection strings + advanced options
* Compatible with legacy config
* Replace callback by `connected` event
* Add debug

Fix #51, #58, #62, #66, #70, #85, #94, #96, #115, #117, #120
Fix #124, #128, #129, #130, #131, #133, #134
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants