mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 05:01:14 -07:00
Bump pyjwt from 2.3.0 to 2.4.0 (#1743)
* Bump pyjwt from 2.3.0 to 2.4.0 Bumps [pyjwt](https://github.com/jpadilla/pyjwt) from 2.3.0 to 2.4.0. - [Release notes](https://github.com/jpadilla/pyjwt/releases) - [Changelog](https://github.com/jpadilla/pyjwt/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jpadilla/pyjwt/compare/2.3.0...2.4.0) --- updated-dependencies: - dependency-name: pyjwt dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update pyjwt==2.4.0 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
d17015de44
commit
b3aeaafd00
9 changed files with 171 additions and 61 deletions
|
@ -9,6 +9,8 @@ from .utils import (
|
|||
der_to_raw_signature,
|
||||
force_bytes,
|
||||
from_base64url_uint,
|
||||
is_pem_format,
|
||||
is_ssh_key,
|
||||
raw_to_der_signature,
|
||||
to_base64url_uint,
|
||||
)
|
||||
|
@ -183,14 +185,7 @@ class HMACAlgorithm(Algorithm):
|
|||
def prepare_key(self, key):
|
||||
key = force_bytes(key)
|
||||
|
||||
invalid_strings = [
|
||||
b"-----BEGIN PUBLIC KEY-----",
|
||||
b"-----BEGIN CERTIFICATE-----",
|
||||
b"-----BEGIN RSA PUBLIC KEY-----",
|
||||
b"ssh-rsa",
|
||||
]
|
||||
|
||||
if any(string_value in key for string_value in invalid_strings):
|
||||
if is_pem_format(key) or is_ssh_key(key):
|
||||
raise InvalidKeyError(
|
||||
"The specified key is an asymmetric key or x509 certificate and"
|
||||
" should not be used as an HMAC secret."
|
||||
|
@ -417,6 +412,12 @@ if has_crypto:
|
|||
except ValueError:
|
||||
key = load_pem_private_key(key, password=None)
|
||||
|
||||
# Explicit check the key to prevent confusing errors from cryptography
|
||||
if not isinstance(key, (EllipticCurvePrivateKey, EllipticCurvePublicKey)):
|
||||
raise InvalidKeyError(
|
||||
"Expecting a EllipticCurvePrivateKey/EllipticCurvePublicKey. Wrong key provided for ECDSA algorithms"
|
||||
)
|
||||
|
||||
return key
|
||||
|
||||
def sign(self, msg, key):
|
||||
|
@ -545,26 +546,28 @@ if has_crypto:
|
|||
pass
|
||||
|
||||
def prepare_key(self, key):
|
||||
|
||||
if isinstance(
|
||||
key,
|
||||
(Ed25519PrivateKey, Ed25519PublicKey, Ed448PrivateKey, Ed448PublicKey),
|
||||
):
|
||||
return key
|
||||
|
||||
if isinstance(key, (bytes, str)):
|
||||
if isinstance(key, str):
|
||||
key = key.encode("utf-8")
|
||||
str_key = key.decode("utf-8")
|
||||
|
||||
if "-----BEGIN PUBLIC" in str_key:
|
||||
return load_pem_public_key(key)
|
||||
if "-----BEGIN PRIVATE" in str_key:
|
||||
return load_pem_private_key(key, password=None)
|
||||
if str_key[0:4] == "ssh-":
|
||||
return load_ssh_public_key(key)
|
||||
key = load_pem_public_key(key)
|
||||
elif "-----BEGIN PRIVATE" in str_key:
|
||||
key = load_pem_private_key(key, password=None)
|
||||
elif str_key[0:4] == "ssh-":
|
||||
key = load_ssh_public_key(key)
|
||||
|
||||
raise TypeError("Expecting a PEM-formatted or OpenSSH key.")
|
||||
# Explicit check the key to prevent confusing errors from cryptography
|
||||
if not isinstance(
|
||||
key,
|
||||
(Ed25519PrivateKey, Ed25519PublicKey, Ed448PrivateKey, Ed448PublicKey),
|
||||
):
|
||||
raise InvalidKeyError(
|
||||
"Expecting a EllipticCurvePrivateKey/EllipticCurvePublicKey. Wrong key provided for EdDSA algorithms"
|
||||
)
|
||||
|
||||
return key
|
||||
|
||||
def sign(self, msg, key):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue