Skip to content

Add TrustAllCertificates in CRT S3 Client options #3903

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

Merged
merged 2 commits into from
Apr 19, 2023

Conversation

joviegas
Copy link
Contributor

@joviegas joviegas commented Apr 11, 2023

Motivation and Context

  • S3 Crtclient did not have a way to disable TrustCertificates in its in-built http client

Modifications

Based on https://github.com/aws/aws-sdk-java-v2/blob/master/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/AwsCrtAsyncHttpClient.java#L103 added a option in S3CrtHttpConfiguration class to disable TrustAllCertificates options

Testing

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

License

  • I confirm that this pull request can be released under the Apache 2 license

@joviegas joviegas requested a review from a team as a code owner April 11, 2023 19:32
@joviegas joviegas force-pushed the joviegas/trust_certificate branch from e526312 to 5a66a9d Compare April 11, 2023 19:35
* @param shouldTrustAllCertificates True if SSL cert validation is disabled.
* @return The builder of the method chaining.
*/
Builder shouldTrustAllCertificates(Boolean shouldTrustAllCertificates);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe trustAllCertificatesEnabled to be consistent with existing boolean options?

* This turns off x.509 validation.
* By default, this option is off.
* Only enable this option for testing purposes.
* </p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: </p> is not needed; a single <p> should be sufficient


if (builder.httpConfiguration != null
&& builder.httpConfiguration.shouldTrustAllCertificates() != null) {
clientTlsContextOptions.withVerifyPeer(!builder.httpConfiguration.shouldTrustAllCertificates());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we log a warning message here if it's enabled?

SSL Certificate verification is disabled. This is not a safe setting and should only be used for testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had following concern
-> User had disabled the SSL certificate validation for testing but user doesnot want anyone to know about it. If we are loggin it then we are making this info available to everyone who is accessing the logs.

Because of this this reason I was not sure if we should log this , what do you say about this scenario ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

50.0% 50.0% Coverage
0.0% 0.0% Duplication

@joviegas joviegas merged commit 234f08c into master Apr 19, 2023
aws-sdk-java-automation added a commit that referenced this pull request Apr 19, 2023
…#2467)

* Update to next snapshot version: 2.20.49-SNAPSHOT

* Fix flaky IMDS client test (#3912)

This test should be less flaky since the mock client should never trigger the
retry logic in the IMDS client by sometimes returning a 500.

* Add TrustAllCertificates in CRT S3 Client options (#3903)

* Add TrustAllCertificates in CRT S3 Client options

* Handled PR comments

* Amazon Relational Database Service Update: Adds support for the ImageId parameter of CreateCustomDBEngineVersion to RDS Custom for Oracle

* AWS SecurityHub Update: Update that adds SDK code examples for Security Hub

* Amazon Comprehend Update: This release supports native document models for custom classification, in addition to plain-text models. You train native document models using documents (PDF, Word, images) in their native format.

* Amazon Simple Storage Service Update: Provides support for "Snow" Storage class.

* Amazon EC2 Container Service Update: This release supports the Account Setting "TagResourceAuthorization" that allows for enhanced Tagging security controls.

* AWS Secrets Manager Update: Documentation updates for Secrets Manager

* AWS S3 Control Update: Provides support for overriding endpoint when region is "snow". This will enable bucket APIs for Amazon S3 Compatible storage on Snow Family devices.

* AWS Resource Access Manager Update: This release adds support for customer managed permissions. Customer managed permissions enable customers to author and manage tailored permissions for resources shared using RAM.

* Updated endpoints.json and partitions.json.

* Release 2.20.49. Updated CHANGELOG.md, README.md and all pom.xml.

---------

Co-authored-by: AWS <>
Co-authored-by: Dongie Agnir <[email protected]>
Co-authored-by: John Viegas <[email protected]>
millems added a commit that referenced this pull request Apr 19, 2023
* Pull request: release <- staging/31d9787e-9a7d-4544-bbf2-ffb44eac702a (#2467)

* Update to next snapshot version: 2.20.49-SNAPSHOT

* Fix flaky IMDS client test (#3912)

This test should be less flaky since the mock client should never trigger the
retry logic in the IMDS client by sometimes returning a 500.

* Add TrustAllCertificates in CRT S3 Client options (#3903)

* Add TrustAllCertificates in CRT S3 Client options

* Handled PR comments

* Amazon Relational Database Service Update: Adds support for the ImageId parameter of CreateCustomDBEngineVersion to RDS Custom for Oracle

* AWS SecurityHub Update: Update that adds SDK code examples for Security Hub

* Amazon Comprehend Update: This release supports native document models for custom classification, in addition to plain-text models. You train native document models using documents (PDF, Word, images) in their native format.

* Amazon Simple Storage Service Update: Provides support for "Snow" Storage class.

* Amazon EC2 Container Service Update: This release supports the Account Setting "TagResourceAuthorization" that allows for enhanced Tagging security controls.

* AWS Secrets Manager Update: Documentation updates for Secrets Manager

* AWS S3 Control Update: Provides support for overriding endpoint when region is "snow". This will enable bucket APIs for Amazon S3 Compatible storage on Snow Family devices.

* AWS Resource Access Manager Update: This release adds support for customer managed permissions. Customer managed permissions enable customers to author and manage tailored permissions for resources shared using RAM.

* Updated endpoints.json and partitions.json.

* Release 2.20.49. Updated CHANGELOG.md, README.md and all pom.xml.

---------

Co-authored-by: AWS <>
Co-authored-by: Dongie Agnir <[email protected]>
Co-authored-by: John Viegas <[email protected]>

* Remove unnecessary ACL integration test for S3. (#2468)

* Update to next snapshot version: 2.20.50-SNAPSHOT

---------

Co-authored-by: aws-sdk-java-automation <[email protected]>
Co-authored-by: Dongie Agnir <[email protected]>
Co-authored-by: John Viegas <[email protected]>
@joviegas joviegas deleted the joviegas/trust_certificate branch August 30, 2023 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants