Skip to content

Add an option to disable CA certificate pinning#310

Merged
AaronAtDuo merged 1 commit into
masterfrom
disable-ca-pinning
Jun 24, 2026
Merged

Add an option to disable CA certificate pinning#310
AaronAtDuo merged 1 commit into
masterfrom
disable-ca-pinning

Conversation

@cisco-dmytro-hissa

Copy link
Copy Markdown
Contributor

Description

  • Added disable_ca_pinning=False parameter to Client.__init__()
  • Added validation that raises ValueError if both disable_ca_pinning=True and a custom ca_certs path are provided
  • Added a new branch in _connect() that, when disable_ca_pinning is enabled, creates an http.client.HTTPSConnection with ssl.create_default_context() instead of using CertValidatingHTTPSConnection with the bundled CA bundle
  • Added --disable-ca-pinning argument to the CLI main() entry point

How Has This Been Tested?

  • TestDisableCaPinningInit — 7 tests verifying constructor behavior:
    • Default value is False and uses bundled CA certs
    • Can be set to True with default or None ca_certs
    • Raises ValueError when combined with a custom ca_certs path
    • Raises ValueError when combined with ca_certs='HTTP'
    • Raises ValueError when combined with ca_certs='DISABLE'
  • TestDisableCaPinningConnect — 5 tests verifying connection behavior:
    • Default client uses CertValidatingHTTPSConnection (pinned)
    • Disabled pinning uses http.client.HTTPSConnection (not pinned)
    • Disabled pinning still has ssl.CERT_REQUIRED and check_hostname=True
    • Disabled pinning SSL context matches ssl.create_default_context() settings
    • Default client has CERT_REQUIRED on its custom SSL context

Types of Changes

  • 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 change)

@cisco-dmytro-hissa cisco-dmytro-hissa marked this pull request as ready for review June 24, 2026 15:18
@AaronAtDuo AaronAtDuo merged commit 6e207eb into master Jun 24, 2026
5 checks passed
@AaronAtDuo AaronAtDuo deleted the disable-ca-pinning branch June 24, 2026 16:53
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