Add an option to disable CA certificate pinning#45
Merged
Conversation
cisco-dmytro-hissa
marked this pull request as ready for review
June 30, 2026 09:14
AaronAtDuo
approved these changes
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
disable_ca_pinning: keyword argument toDuoApi#initializethat, when set totrue, skips passing the bundledca_certs.pemtoNet::HTTP, allowing TLS verification to fall back to the OS trust store insteadof pinning to Duo's CA bundle
ArgumentErrorif bothdisable_ca_pinning: trueand a customca_file: are provided, since the two options are contradictoryca_pinning_disabledattr_reader for inspecting the pinning stateNet::HTTP.startto build HTTP options dynamically, only includingca_filewhen it is non-nilHow Has This Been Tested?
test_default_has_ca_pinning_enabled— verifies default behavior is unchanged: pinning enabled,ca_filepoints to bundled certtest_disable_ca_pinning_removes_ca_file— verifiesdisable_ca_pinning: truesetsca_fileto niltest_disable_ca_pinning_and_custom_ca_file_raises— verifiesArgumentErroris raised when both options are settest_disable_ca_pinning_and_custom_ca_file_error_message— verifies the error message is descriptivetest_custom_ca_file_without_disable_works— verifies customca_filestill works when pinning is not disabledtest_pinned_client_passes_ca_file_to_http— verifies at the HTTP layer that a pinned client passesca_filetoNet::HTTP.starttest_unpinned_client_does_not_pass_ca_file_to_http— verifies at the HTTP layer that an unpinned client omitsca_filefromNet::HTTP.startwhile still usingVERIFY_PEERTypes of Changes