digitalbazaar / bedrock-mongodb

Bedrock mongodb module
Apache License 2.0
2 stars 3 forks source link

Mongo driver 4 rc no auth defaults #93

Open aljones15 opened 2 years ago

aljones15 commented 2 years ago

This was tested locally with a server with authentication on. The following was the result:

 MONGODB_URL="mongodb://bedrock_mongodb_test-user:password@localhost:27017/bedrock_mongodb_test" npm t
{
  url: 'mongodb://bedrock_mongodb_test-user:password@localhost:27017/bedrock_mongodb_test',
  connectOptions: {
    serverSelectionTimeoutMS: 30000,
    promoteBuffers: true,
    forceServerObjectId: true,
    writeConcern: { w: 'majority', j: true }
  }
}
... test results all passed

Additionally I tested what happens if someone sets connectOptions.auth

 MONGODB_USERNAME=bedrock_mongodb_test-user MONGODB_PASSWORD=password npm t

> bedrock-mongodb-test@0.0.1-0 test
> node --preserve-symlinks test.js test

{
  url: 'mongodb://localhost:27017/bedrock_mongodb_test',
  connectOptions: {
    serverSelectionTimeoutMS: 30000,
    promoteBuffers: true,
    forceServerObjectId: true,
    auth: { username: 'bedrock_mongodb_test-user', password: 'password' },
    writeConcern: { w: 'majority', j: true }
  }
}
... all tests passing
  1. Removes config.mongodb.username
  2. Removes config.mongodb.password
  3. Removes authn checks from connect
  4. Renames ./lib/authn.js to ./lib/connect.js
  5. Removes auth details from urls.create
  6. Updates auth tests to use a connection string
  7. Drops support for node v14 from ci actions (reduces ci action minutes used)

PR Mystery that needs to be solved:

Resolves this issue, by removing auth defaults: https://github.com/digitalbazaar/bedrock-mongodb/issues/54

codecov-commenter commented 2 years ago

Codecov Report

Merging #93 (ad561c7) into mongo-driver-4-rc (1b4c0e6) will increase coverage by 2.40%. The diff coverage is 50.00%.

@@                  Coverage Diff                  @@
##           mongo-driver-4-rc      #93      +/-   ##
=====================================================
+ Coverage              87.08%   89.48%   +2.40%     
=====================================================
  Files                      8        8              
  Lines                    813      742      -71     
=====================================================
- Hits                     708      664      -44     
+ Misses                   105       78      -27     
Impacted Files Coverage Δ
lib/authn.js 83.72% <ø> (+6.67%) :arrow_up:
lib/index.js 81.85% <0.00%> (+0.71%) :arrow_up:
lib/test.config.js 100.00% <ø> (ø)
lib/urls.js 91.48% <ø> (+6.30%) :arrow_up:
lib/config.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.