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

Explicitly load default certificates when creating SSL context (#1583) #1596

Merged
merged 2 commits into from
Nov 1, 2024

Conversation

AdamWill
Copy link
Contributor

@AdamWill AdamWill commented Sep 4, 2024

Requests prior to 2.32.3 always loaded the default (system-wide) set of trusted certificates into custom SSL contexts. 2.32.3 no longer does. This has broken a lot of users, but the fix is moving slowly upstream due to security considerations - see psf/requests#6730 and psf/requests#6731 .

As suggested at psf/requests#6710 (comment) this can be worked around by explicitly loading the default certificates into the context. We check the method exists before calling it just to be safe, it was added in Python 3.4.

Also, drop the dependency pin as it's no longer needed with this workaround.

…e#1583)

Requests prior to 2.32.3 always loaded the default (system-wide)
set of trusted certificates into custom SSL contexts. 2.32.3 no
longer does. This has broken a lot of users, but the fix is
moving slowly upstream due to security considerations - see
psf/requests#6730 and
psf/requests#6731 .

As suggested at
psf/requests#6710 (comment)
this can be worked around by explicitly loading the default
certificates into the context. We check the method exists before
calling it just to be safe, it was added in Python 3.4.

Signed-off-by: Adam Williamson <[email protected]>
As we can now work with requests 2.32.3+, we no longer need this
pin.

Signed-off-by: Adam Williamson <[email protected]>
@AdamWill AdamWill force-pushed the requests-2323-load-default-certs branch from c84503a to b374fa8 Compare September 6, 2024 22:49
@AdamWill
Copy link
Contributor Author

AdamWill commented Sep 6, 2024

tweaked to only do anything if there are no certs loaded into the context already, just in case there's some way you could cause custom certs to be used via an environment variable or something.

@hinricht
Copy link

Please merge soon !

@IceCodeNew
Copy link

I just confronted this problem, really appreciate the fix.
I am wondering if somebody could help merge this PR.

@jkbrzt jkbrzt merged commit fd30c4e into httpie:master Nov 1, 2024
1 of 38 checks passed
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Nov 4, 2024
## [3.2.4](httpie/cli@3.2.3...3.2.4) (2024-11-01)

- Fix default certs loading and unpin `requests`. ([#1596](httpie/cli#1596))
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.

4 participants