Repository navigation
fix: verify TLS against certifi instead of a vendored cacert.pem - #272
Open
dominicroessner wants to merge 1 commit into
Open
dominicroessner wants to merge 1 commit into
dominicroessner wants to merge 1 commit into
Conversation
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.
What does this PR do?
Stops shipping
pusher/cacert.pemand verifies TLS againstcertifi.where()instead.The vendored bundle was last updated in 2021 and still trusts
emSign ECC Root CA - G3andAAA Certificate Services. Those are the roots that the 8 compromised eMudhra intermediate CAs chain to (see #271 for details and links). BecauseRequestsBackendforcesverifyto that bundle, a client on any released version accepts a forged certificate for the Pusher API from those keys, regardless of whichcertifiis installed.Changes:
pusher/cacert.pem: removedpusher/requests.py:CERT_PATH = certifi.where()(name kept so existing imports keep working)setup.py: addcertifitoinstall_requires; drop thepackage_dataentry forcacert.pempusher_tests/test_requests_adapter.py: tests that https requests usecertifi.where()and that http requests set noverifyFixes #271. Complementary to #270, which bumps certifi in the dev/test pins in
requirements.txtonly; that does not affect what the library trusts at runtime, which is why this change is needed.Testing
python -m unittest discover -s pusher_tests --top-level-directory .passes on Python 3.10, 3.11 and 3.12 (68 tests, 1 skipped; 66 before this change).verifytest fails against the oldrequests.pyandcacert.pem.cacert.pemand declaresRequires-Dist: certifi.triggeragainst the public test hosts from https://emudhra.we-have-a-problem.com/ (dv-g3b-emudhraanddv-g3b-aaa-emudhra). Both are now rejected with anSSLError. On 3.3.4 they are accepted.Notes
RequestsBackendstill overwrites any caller-suppliedverifyoption, as before. Letting callers override it (e.g.setdefault) would be a reasonable follow-up, but I kept this PR to the bundle itself.If you have changed dependencies, ensure both
requirements.txtandsetup.pyhave been updatedCHANGELOG
cacert.pemand verify TLS againstcertifi.where(). The bundled roots still trusted the compromised eMudhra intermediate CAs.