-
Notifications
You must be signed in to change notification settings - Fork 246
DRIVERS-3131: No explicitly provided properties with MONGODB-AWS #1847
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
30808eb
8ed234a
51184d3
df19d50
8a8ecaf
6633b5a
aad1e8a
7714280
714e051
1780f54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -320,6 +320,15 @@ tests: | |
mechanism: MONGODB-AWS | ||
mechanism_properties: | ||
AWS_SESSION_TOKEN: token!@#$%^&*()_+ | ||
- description: should throw an exception if username provided (MONGODB-AWS) | ||
uri: mongodb://[email protected]/?authMechanism=MONGODB-AWS | ||
valid: false | ||
- description: should throw an exception if username and password provided (MONGODB-AWS) | ||
uri: mongodb://user:[email protected]/?authMechanism=MONGODB-AWS | ||
valid: false | ||
- description: should throw an exception if AWS_SESSION_TOKEN provided (MONGODB-AWS) | ||
uri: mongodb://localhost/?authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:token | ||
valid: false | ||
- description: should recognise the mechanism with test environment (MONGODB-OIDC) | ||
uri: mongodb://localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:test | ||
valid: true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
Drivers MUST test the following scenarios: | ||
|
||
1. `Regular Credentials`: Auth via an `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` pair | ||
1. `Regular Credentials`: Auth via an `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` pair *Removed* | ||
2. `EC2 Credentials`: Auth from an EC2 instance via temporary credentials assigned to the machine | ||
3. `ECS Credentials`: Auth from an ECS instance via temporary credentials assigned to the task | ||
4. `Assume Role`: Auth via temporary credentials obtained from an STS AssumeRole request | ||
|
@@ -12,8 +12,7 @@ Drivers MUST test the following scenarios: | |
7. Caching of AWS credentials fetched by the driver. | ||
|
||
For brevity, this section gives the values `<AccessKeyId>`, `<SecretAccessKey>` and `<Token>` in place of a valid access | ||
key ID, secret access key and session token (also known as a security token). Note that if these values are passed into | ||
the URI they MUST be URL encoded. Sample values are below. | ||
key ID, secret access key and session token (also known as a security token). Sample values are below. | ||
|
||
```text | ||
AccessKeyId=AKIAI44QH8DHBEXAMPLE | ||
|
@@ -37,14 +36,7 @@ directly from the custom provider instead of using the AWS SDK default provider. | |
|
||
### 2. Custom Credential Provider Authentication Precedence | ||
|
||
#### Case 1: Credentials in URI Take Precedence | ||
|
||
Create a `MongoClient` configured with AWS auth and credentials in the URI. Example: | ||
`mongodb://<AccessKeyId>:<SecretAccessKey>@localhost:27017/?authMechanism=MONGODB-AWS` | ||
|
||
Configure a custom credential provider to pass valid AWS credentials. The provider must track if it was called. | ||
|
||
Expect authentication to succeed and the custom credential provider was *not* called. | ||
#### Case 1: Credentials in URI Take Precedence *Removed* | ||
|
||
#### Case 2: Custom Provider Takes Precedence Over Environment Variables | ||
|
||
|
@@ -59,11 +51,11 @@ Expect authentication to succeed and the custom credential provider was called. | |
|
||
## Regular credentials | ||
|
||
Drivers MUST be able to authenticate by providing a valid access key id and secret access key pair as the username and | ||
password, respectively, in the MongoDB URI. An example of a valid URI would be: | ||
Drivers MUST be able to authenticate when a valid access key id and secret access key pair are present in the | ||
environment. Drivers MUST provide the --nouri option to aws_tester.py in drivers-evergreen-tools for this test. | ||
|
||
```text | ||
mongodb://<AccessKeyId>:<SecretAccessKey>@localhost/?authMechanism=MONGODB-AWS | ||
mongodb://localhost/?authMechanism=MONGODB-AWS | ||
``` | ||
|
||
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 should also update the other prose tests that are no longer relevant in this file (strike-through, or replace the title with 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. All the the prose tests are still valid and I updated the assume role test to note as well to pass --nouri 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. I believe Case 1 above would fall into the category of "no longer relevant" after this set of changes, so I was suggesting the strike-through method. There is also a callout about URI encoding in L15-16 of this file that should probably be amended. 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. I've added the Removed label to the titles. 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. I don't think those are the tests we want to remove. In addition, the guidelines for removing tests say to either remove the whole test and replace the title with "Removed" OR strikethrough the entire content - just adding a "removed" label and keeping everything else in place might be confusing. |
||
## EC2 Credentials | ||
|
@@ -95,11 +87,11 @@ mongodb://localhost/?authMechanism=MONGODB-AWS | |
## AssumeRole | ||
|
||
Drivers MUST be able to authenticate using temporary credentials returned from an assume role request. These temporary | ||
credentials consist of an access key ID, a secret access key, and a security token passed into the URI. A sample URI | ||
would be: | ||
credentials consist of an access key ID, a secret access key, and a security token present in the environment. Drivers | ||
MUST provide the --nouri option to aws_tester.py in drivers-evergreen-tools for this test. A sample URI would be: | ||
|
||
```text | ||
mongodb://<AccessKeyId>:<SecretAccessKey>@localhost/?authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:<Token> | ||
mongodb://localhost/?authMechanism=MONGODB-AWS | ||
``` | ||
|
||
## Assume Role with Web Identity | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we still want to test this with env vars?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is now fixed.