-
Notifications
You must be signed in to change notification settings - Fork 245
DRIVERS-3207: Custom AWS credential providers execute earlier #1838
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
base: master
Are you sure you want to change the base?
Changes from all commits
37dd055
e5534c5
0afb4e1
d9de2c0
68fd633
94c7a1f
1859b77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -959,6 +959,11 @@ Examples are provided below. | |
|
||
Drivers MUST allow the user to specify an AWS session token for authentication with temporary credentials. | ||
|
||
- AWS_CREDENTIAL_PROVIDER | ||
|
||
Drivers MAY allow the user to specify a custom credential provider object or function. See | ||
[Custom Credential Providers](https://github.com/mongodb/specifications/blob/master/source/auth/auth.md#custom-credential-providers) | ||
|
||
#### Obtaining Credentials | ||
|
||
Drivers will need AWS IAM credentials (an access key, a secret access key and optionally a session token) to complete | ||
|
@@ -1006,8 +1011,8 @@ Drivers MAY expose API for default providers for the following scenarios when ap | |
The order in which Drivers MUST search for credentials is: | ||
|
||
1. The URI | ||
2. Environment variables | ||
3. A custom AWS credential provider if the driver supports it. | ||
2. A custom AWS credential provider if the driver supports it. | ||
3. Environment variables | ||
4. Using `AssumeRoleWithWebIdentity` if `AWS_WEB_IDENTITY_TOKEN_FILE` and `AWS_ROLE_ARN` are set. | ||
5. The ECS endpoint if `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI` is set. Otherwise, the EC2 endpoint. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's make sure to remember to update the changelog There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated. |
||
|
@@ -2157,6 +2162,8 @@ practice to avoid this. (See | |
|
||
## Changelog | ||
|
||
- 2025-09-10: Update precedence of MONGODB-AWS credential fetching behaviour. | ||
|
||
- 2025-01-29: Add support for custom AWS credential providers. | ||
|
||
- 2024-10-02: Add Kubernetes built-in OIDC provider integration. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,15 +21,17 @@ SecretAccessKey=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY | |
Token=AQoDYXdzEJr...<remainder of security token> | ||
``` | ||
|
||
If the driver supports user provided custom AWS credential providers, then the driver MUST also test the above scenarios | ||
2-6 with a user provided `AWS_CREDENTIAL_PROVIDER` auth mechanism property. This value MUST be the default credential | ||
provider from the AWS SDK. If the default provider does not cover all scenarios above, those not covered MAY be skipped. | ||
In these tests the driver MUST also assert that the user provided credential provider was called at least once in each | ||
test. | ||
|
||
If the driver supports a custom AWS credential provider, it MUST verify the custom provider was used when testing. This | ||
may be via a custom function or object that wraps the calls to the custom provider and asserts that it was called at | ||
least once. | ||
## Testing custom credential providers | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have any tests that test the precedence that drivers use when fetching credentials?a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do not, as our drivers tools scripts only set up one type of credential per test, not multiples. |
||
|
||
If the driver supports custom AWS credential providers, the driver MUST test the following: | ||
|
||
Scenarios 1-6 from the previous section with a user provided `AWS_CREDENTIAL_PROVIDER` auth mechanism property. This | ||
value MAY be the default credential provider from the AWS SDK. If the default provider does not cover all scenarios | ||
above, those not covered MAY be skipped. In these tests the driver MUST also assert that the user provided credential | ||
provider was called in each test. This may be via a custom function or object that wraps the calls to the custom | ||
provider and asserts that it was called at least once. For test scenarios where the drivers tools scripts put the | ||
credentials in the MONGODB_URI, drivers MAY extract the credentials from the URI and return the AWS credentials directly | ||
from the custom provider instead of using the AWS SDK default provider. | ||
|
||
## Regular credentials | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.