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

Merge develop for release 1.2 #9

Merged
merged 21 commits into from
Feb 18, 2021
Merged

Merge develop for release 1.2 #9

merged 21 commits into from
Feb 18, 2021

Conversation

DontPanicO
Copy link
Owner

@DontPanicO DontPanicO commented Feb 18, 2021

Merge develop, for release 1.2
Closes (#7, #8)
FIXED

  • CVE 2020-28042 null signature
    ENANCHEMENT
  • Dropped off pyOpenSSL dependency
  • Dropped usage of subprocess to internal python methods
  • Improved --auto-try efficency
  • Certificates generation now use cryptography library

DontPanicO and others added 21 commits February 13, 2021 12:44
In order to drop off most of subprocess call, a method to generates self signed certificates has been added
Certificate was generate calling openssl commands using subprocess. In order to avoid using subprocess (except for specific cases) certificate generation has moved to cryptography, producing more scalable x509 objects. The method was already been implemented  with the last merge, with this commit I'm changing validation and x5u functions according to it. Validation now has just to look for self.path_to_key, as attribute that give a key file to read from. x5u functions, need only to grab self.x5c (that's already been converted to x5c format), without open and process any file. During certificate generation now no file will be produced anymore, that's the most beneficial things
Generating public key from x5c, was using a non imported method. This has been fixed
Since certificates are now generated using cryptography (see two commits behind), looking for remove the 'testing.crt' file if exists, is now useless, so has been removed
Following the last commits intention (dropping off subprocess as far as possible), the method get_key_from_ssl_certs, now use the ssl library, instead of calling the s_client via subprocess. This removed other two file to handle with, and lot of line of code. Exception for non existing domain, or missing connection has to be checked up.
Two exception of the new auto_try feature (see previous commit), has been handled. This require to import the socket library. If exception to handle will get more, maybe a singl 'except Exception' statement should be used, even if it's going to be not pep8 compliant (there's so many things here that are not).
Added support for null signature. New option --null-signature, provide a token with 'HEADER.PAYLOAD.' format, instead of 'HEADER.PAYLOAD.SIGNATURE'. This does not depend on algorithm (setting alg as None generates no signature), user can provide every supported algorithm without this being overidden. Of course, setting this options will make the tool skipping al key validation; since signature is going to be a null character, it would be uselessly resource-consuming
Since now certificates and public keys retrieved with get_key_from_ssl_cert are stored as cryptography objects, we need no more to look for such filenames. So those states has been removed. Useless white lines used in docstrings has been removed
In order to stop using subprocess (for make the script more windows compatible, even if it's not a priority), now jwks files are downloaded with urllib.request instead of calling wget with subprocess. The method download_jwks has been added and implemented in jku/x5u functions. Subprocess can now be dropped off from imports. Anyway this functionality has to be considered experimental, since exceptions handling is not covering all possible errors yet (we have to ran tests). We won't use a generic except statement, since is a bad way to handle errors
Since urllib import are controversial (if you import urllib, interpreter won't access parse, error and request files, or if you import urllib.request, it implicit import also error and parse), the import has been moved to the most secure (secure only for this excepional case) way. 'from urllib import request, error, parse', works fine, without having implicits imports or double imports. Even if this is not good, especially for 'error', that's a common word, is not going to generate warnings for now'
Found two issues:
1) JWKS files not properly generated with jku and x5u functions.
2) (minor) --find-key-from-jwks, was returning an error if no key in the jwks file can verify the token
This issues are being closed with this commit
dropped off pyOpenSSL dependency
@DontPanicO DontPanicO self-assigned this Feb 18, 2021
@DontPanicO DontPanicO merged commit c9a2031 into main Feb 18, 2021
@DontPanicO DontPanicO changed the title Merge develop for release 1.3 Merge develop for release 1.2 Feb 18, 2021
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.

AttributeError if jwks file does not contain the verifier key JWKS file not properly generated
1 participant