Bug #47685
crash sur algo inconnu reçu en signature
Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
14 octobre 2020
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Non
Description
Exception: type = '<class 'TypeError'>', value = '__hash_new() missing 1 required positional argument: 'name'' Stack trace (most recent call first): File "/usr/lib/python3.7/hmac.py", line 65, in __init__ 63 self.digest_cons = lambda d=b'': digestmod.new(d) 64 > 65 self.outer = self.digest_cons() 66 self.inner = self.digest_cons() 67 self.digest_size = self.inner.digest_size locals: digestmod = <function __hash_new at 0x7ff1a5412510> key = b'68902cd083fcc941ffe6c0c9ab64aac75165abc799b12555fdc69fb6225cc0d3' msg = b'algo=new×tamp=2020-10-14T11%3A29%3A19Z&nonce=4a0a994619344213167373c3615ef5a1&orig=intranet' self = <hmac.HMAC object at 0x7ff19b3a2278> File "/usr/lib/python3.7/hmac.py", line 153, in new 151 method. 152 """ > 153 return HMAC(key, msg, digestmod) 154 155 locals: digestmod = <method-wrapper '__getattribute__' of module object at 0x7ff1a5425a48> key = b'68902cd083fcc941ffe6c0c9ab64aac75165abc799b12555fdc69fb6225cc0d3' msg = b'algo=__getattribute__×tamp=2020-10-14T11%3A29%3A19Z&nonce=4a0a994619344213167373c3615ef5a1&orig=intranet' File "/usr/lib/python3/dist-packages/wcs/api_utils.py", line 63, in is_url_signed 61 raise AccessForbiddenError('invalid algo') 62 if signature != base64.standard_b64encode( > 63 hmac.new(force_bytes(key), force_bytes(query_string[:query_string.find('&signature=')]), algo).digest()): 64 raise AccessForbiddenError('invalid signature') 65 timestamp = get_request().form.get('timestamp') locals: algo = <method-wrapper '__getattribute__' of module object at 0x7ff1a5425a48> duration = 30 key = '68902cd083fcc941ffe6c0c9ab64aac75165abc799b12555fdc69fb6225cc0d3' orig = 'intranet' query_string = 'algo=__getattribute__×tamp=2020-10-14T11%3A29%3A19Z&nonce=4a0a994619344213167373c3615ef5a1&orig=intranet&signature=7%2FZsbbhmAWGH4c565a9Kfg%3D%3D' signature = b'7/ZsbbhmAWGH4c565a9Kfg==' utcnow = None
Fichiers
Révisions associées
Historique
Mis à jour par Thomas Noël il y a plus de 3 ans
- Fichier 0001-api-use-hashlib-to-validate-algo-parameter-47685.patch 0001-api-use-hashlib-to-validate-algo-parameter-47685.patch ajouté
- Statut changé de Nouveau à Solution proposée
- Patch proposed changé de Non à Oui
Ajoutons une vérification propre en utilisant le nouveau hashlib.algorithms_guaranteed disponible en python 3.
Mis à jour par Frédéric Péters il y a plus de 3 ans
- Statut changé de Solution proposée à Solution validée
Mis à jour par Thomas Noël il y a plus de 3 ans
- Statut changé de Solution validée à Résolu (à déployer)
commit cc16562f9097550a189bcf272f6fea12f3fa92d7 Author: Thomas NOEL <tnoel@entrouvert.com> Date: Wed Oct 14 15:05:31 2020 +0200 api: use hashlib to validate algo parameter (#47685)
Mis à jour par Frédéric Péters il y a plus de 3 ans
- Statut changé de Résolu (à déployer) à Solution déployée
api: use hashlib to validate algo parameter (#47685)