-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(NODE-5939): Implement 6.x: cache the AWS credentials provider in the MONGODB-AWS auth logic #3991
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alenakhineika
changed the title
feat(NODE-5616): cache the AWS credentials provider in the MONGODB-AWS auth logic
feat(NODE-5939): Implement 6.x: cache the AWS credentials provider in the MONGODB-AWS auth logic
Feb 15, 2024
durran
added
the
Primary Review
In Review with primary reviewer, not yet ready for team's eyes
label
Feb 19, 2024
durran
requested changes
Feb 19, 2024
durran
approved these changes
Feb 20, 2024
durran
added
Team Review
Needs review from team
and removed
Primary Review
In Review with primary reviewer, not yet ready for team's eyes
labels
Feb 20, 2024
5 tasks
This was referenced Jun 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Cashing credentials is required by the spec.
The AWS credentials provider instance itself is implemented as a smart credentials cache. It will issue at most one request to IMDS, and will only issue another request when the credentials are about to expire.
Instead of creating a new AWS provider for each authentication, we cache the AWS credentials provider per client.
What is changing?
Refactor
AUTH_PROVIDERS
to have factory functions instead of creating providersCreate instances of auth providers in
MongoClient
and cache them when requested per client to ensure that cached credentials are not shared with other clientsgetAuthProvider()
function perClientOptions
, so it can be requested by connection and monitoring to communicate with auth providersMONGODB_DEFAULT
toMONGODB_SCRAM_SHA256
Cache AWS provider per
MongoDBAWS
. AWS SDK will cache the first HTTP request as long as the provider is not reconstructed. We refactor the codebase to ensure that the AWS provider is stored per theMongoDBAWS
instance to prevent overwhelming the auth endpointIs there new documentation needed for these changes?
None
What is the motivation for this change?
NODE-5616
Release Highlight
Caching AWS credentials provider per client
Instead of creating a new AWS provider for each authentication, we cache the AWS credentials provider per client to prevent overwhelming the auth endpoint and ensure that cached credentials are not shared with other clients.
Double check the following
npm run check:lint
scripttype(NODE-xxxx)[!]: description
feat(NODE-1234)!: rewriting everything in coffeescript