-
Notifications
You must be signed in to change notification settings - Fork 82
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
Integration tests - refresh tokens of AWS Clients #1607
Conversation
params = { | ||
'RoleArn': self.role_arn, | ||
'RoleSessionName': self.session_name, | ||
'DurationSeconds': SESSION_EXPIRATION_TIME_IN_SECONDS, |
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.
why is this hardcoded?
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.
It is not a parameter we expose, so I left the default value that we currently use
🧪 Tested in AWS - executed the dataset tests with sleep in-between so that they would take longer than 1h to execute. The client for creation and deletion of S3 Buckets uses the refresh token client and is able to delete the buckets 1h after the client is defined. |
### Feature or Bugfix - Bugfix ### Detail This PR fixes a mismatch between the #1607 and #1603 where get_environment_aws_session is no longer used. In this PR we obtain the session from the new STSClient refreshable token functions introduced in #1607 ### Relates - #1603 - #1607 ### Security Please answer the questions below briefly where applicable, or write `N/A`. Based on [OWASP 10](https://owasp.org/Top10/en/). - Does this PR introduce or modify any input fields or queries - this includes fetching data from storage outside the application (e.g. a database, an S3 bucket)? - Is the input sanitized? - What precautions are you taking before deserializing the data you consume? - Is injection prevented by parametrizing queries? - Have you ensured no `eval` or similar functions are used? - Does this PR introduce any functionality or component that requires authorization? - How have you ensured it respects the existing AuthN/AuthZ mechanisms? - Are you logging failed auth attempts? - Are you using or adding any cryptographic features? - Do you use a standard proven implementations? - Are the used keys controlled by the customer? Where are they stored? - Are you introducing any new policies/roles/users? - Have you used the least-privilege principle? How? By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Feature or Bugfix
Detail
The new integration tests take quite some time (>1h) to get executed. For this reason the AWS clients passed as fixtures to perform different actions (e.g. create S3 Buckets) have expired STS tokens when we reach the teardown operations (e.g. delete S3 Buckets).
This PR implements some logic similar to the one proposed in https://github.com/benkehoe/aws-assume-role-lib which was referenced by the boto3 maintainers in the GitHub issue for this topic.
Relates
Security
Please answer the questions below briefly where applicable, or write
N/A
. Based onOWASP 10.
fetching data from storage outside the application (e.g. a database, an S3 bucket)?
eval
or similar functions are used?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.