Skip to content
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

DisableServerCertificateValidation: Fixes Default HttpClient to honor DisableServerCertificateValidation #4294

Conversation

kirankumarkolli
Copy link
Member

@kirankumarkolli kirankumarkolli commented Feb 1, 2024

Description

When DisableServerCertificateValidation is set:
ServerCertificateCustomValidationCallback is conditionally set after validation when ConnectionPolicy is created. But HttpClient is created before ConnectionPolicy creation resulting in the configuration getting ignored.

changes

  • Make CosmosClientOptions.ServerCertificateCustomValidationCallback immutable post initialization.
    • New internal API GetServerCertificateCustomValidationCallback() which abstracts the certificate validation callback definition.
  • Supporting the combination of both DisableServerCertificateValidation and ServerCertificateCustomValidationCallback combination
  • Supporting test hook for DisableServerCertificateValidationInvocationCallback (specifically for only Disable checking)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] This change requires a documentation update

Closing issues

To automatically close an issue: closes #IssueNumber

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

All good!

@kirankumarkolli kirankumarkolli changed the title DisableServerCertificateValidation: Fix ensuring that both HttpClient… DisableServerCertificateValidation: Fix Default HttpClient to honor DisableServerCertificateValidation Feb 1, 2024
@kirankumarkolli kirankumarkolli changed the title DisableServerCertificateValidation: Fix Default HttpClient to honor DisableServerCertificateValidation DisableServerCertificateValidation: Fixes Default HttpClient to honor DisableServerCertificateValidation Feb 1, 2024
…on and ServerCertificateCustomValidationCallback combination

- Supporting test hook for DisableServerCertificateValidationInvocationCallback (specifically for only Disable checking)
@kirankumarkolli kirankumarkolli force-pushed the users/kirankk/ssl_disable_server_cert_fix branch from 0735a1b to f78efff Compare February 2, 2024 04:23
@kirankumarkolli kirankumarkolli added the auto-merge Enables automation to merge PRs label Feb 2, 2024
kundadebdatta
kundadebdatta previously approved these changes Feb 2, 2024
Copy link
Member

@kundadebdatta kundadebdatta left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: Fabian Meiswinkel <fabian@meiswinkel.com>
Co-authored-by: Fabian Meiswinkel <fabian@meiswinkel.com>
ealsur
ealsur previously approved these changes Feb 2, 2024
Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@kundadebdatta kundadebdatta left a comment

Choose a reason for hiding this comment

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

LGTM. Ideal if we could track this under a GitHub issue.

@microsoft-github-policy-service microsoft-github-policy-service bot merged commit 3f421fb into master Feb 2, 2024
20 checks passed
@microsoft-github-policy-service microsoft-github-policy-service bot deleted the users/kirankk/ssl_disable_server_cert_fix branch February 2, 2024 23:02
kundadebdatta pushed a commit that referenced this pull request Feb 7, 2024
… DisableServerCertificateValidation (#4294)

* DisableServerCertificateValidation: Fix ensuring that both HttpClient and DocumentClient use a consistency way

* E2E Emulator test coverage

* - Supporting the combination of both DisableServerCertificateValidation and ServerCertificateCustomValidationCallback combination

- Supporting test hook for DisableServerCertificateValidationInvocationCallback (specifically for only Disable checking)

* Addressing comments

* Fixing a warning

* Update Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs

Co-authored-by: Fabian Meiswinkel <fabian@meiswinkel.com>

* Update Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs

Co-authored-by: Fabian Meiswinkel <fabian@meiswinkel.com>

* Addressing commens

* Undoing a change

* Fixing UT

* Renaming a test case name

---------

Co-authored-by: Fabian Meiswinkel <fabian@meiswinkel.com>
kundadebdatta pushed a commit that referenced this pull request Feb 7, 2024
… DisableServerCertificateValidation (#4294)

* DisableServerCertificateValidation: Fix ensuring that both HttpClient and DocumentClient use a consistency way

* E2E Emulator test coverage

* - Supporting the combination of both DisableServerCertificateValidation and ServerCertificateCustomValidationCallback combination

- Supporting test hook for DisableServerCertificateValidationInvocationCallback (specifically for only Disable checking)

* Addressing comments

* Fixing a warning

* Update Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs

Co-authored-by: Fabian Meiswinkel <fabian@meiswinkel.com>

* Update Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs

Co-authored-by: Fabian Meiswinkel <fabian@meiswinkel.com>

* Addressing commens

* Undoing a change

* Fixing UT

* Renaming a test case name

---------

Co-authored-by: Fabian Meiswinkel <fabian@meiswinkel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge Enables automation to merge PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants