rfc-st / humble

A humble, and 𝗳𝗮𝘀𝘁, security-oriented HTTP headers analyzer.
https://github.com/rfc-st/humble
MIT License
255 stars 18 forks source link

Resolve "Default Ciphers" Issue #16

Closed ehlewis closed 8 months ago

ehlewis commented 10 months ago

Description

urllib3>2 does not contain the attribute urllib3.util.ssl_.DEFAULT_CIPHERS anymore In lieu of limiting the requirements file to urllib3<2, a code change was requested that would work with all versions The solution is to add an SSL context adapter to the requests session that specifies the cipher suites that we would like to allow

There were two options, some details about them can be found here, the first is that we could use requests.packages.urllib3.util.ssl_.create_urllib3_context However, we already have some code (which happens to be the code that is breaking) that applies logic in case the module requests.packages.urllib3.util.ssl_doesn't exist. As such, we shouldn't use this in case it doesn't exist. A side benefit is that we can remove the logic which was added to account for this Luckily, we have an analogous function ssl.create_default_context upon which we can enforce our custom cipher suite list and then mount it into the requests session. Some similar usage can be found in this issue this module does require importing ssl, but this is a built-in and does not require extra dependencies be installed

As for the cipher suite list, it was copied from the original source code in urllib3 and was appended with the extra suites in this project that were addressing the 'dh key too small' error

Fixes #7

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist:

rfc-st commented 9 months ago

Hi, @ehlewis

Thanks for your contribution!: I have to test it, and see if it solves the problem with current versions of urllib3, request, etc while maintaining compatibility with previous versions of these libraries.

I'll check it as soon as I can and let you know.

Have a nice weekend!.

Best regards

rfc-st commented 8 months ago

Hi,

I am closing this PR as I have had to make several adaptations on the code you suggest. Thank you, of course, for your time.

I will mention you in the "Acknowledgements" section of the README.

Best regards,