Projet

Général

Profil

Bug #33085

crash sur signature non ascii

Ajouté par Thomas Noël il y a presque 5 ans. Mis à jour il y a presque 5 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
14 mai 2019
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

Juste un soucis d'affichage qu'on pourrait résoudre avec un %r je pense:

Subject: Quixote Traceback (UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 37: ordinal not in range(128))

Exception:
  type = '<type 'exceptions.UnicodeDecodeError'>', value = ''ascii' codec can't decode byte 0xef in position 37: ordinal not in range(128)'

Stack trace (most recent call first):
  File "/usr/lib/python2.7/dist-packages/django/core/signing.py", line 181, in unsign
   179         if constant_time_compare(sig, self.signature(value)):
   180             return force_text(value)
>  181         raise BadSignature('Signature "%s" does not match' % sig)
   182
   183

  locals:
     self = <django.core.signing.Signer object at 0x7fc423fe3250>
     sig = 'eKEi4HmLNen8NxFydFYqYgp9VWgt3bjb1hlgu\xef\xbf\xbd\xef\xbf\xbdh5qczg9s7q'
     signed_value = '7a591c41e660a7ea:eKEi4HmLNen8NxFydFYqYgp9VWgt3bjb1hlgu\xef\xbf\xbd\xef\xbf\xbdh5qczg9s7q'
     value = '7a591c41e660a7ea'

Fichiers

Révisions associées

Révision 0bd83cf7 (diff)
Ajouté par Frédéric Péters il y a presque 5 ans

sessions: protect against non-ascii signatures (#33085)

Historique

#1

Mis à jour par Thomas Noël il y a presque 5 ans

Je viens de voir que c'est sur django/core/signing.py que ça se passe, donc il faut agir en amont.

Exception:
  type = '<type 'exceptions.UnicodeDecodeError'>', value = ''ascii' codec can't decode byte 0xef in position 37: ordinal not in range(128)'

Stack trace (most recent call first):
  File "/usr/lib/python2.7/dist-packages/django/core/signing.py", line 181, in unsign
   179         if constant_time_compare(sig, self.signature(value)):
   180             return force_text(value)
>  181         raise BadSignature('Signature "%s" does not match' % sig)
   182
   183

  locals:
     self = <django.core.signing.Signer object at 0x7eff97f58c10>
     sig = 'SDuvZS7k8XmYV2vmdBeHCOyTAPgiscph3n0dv\xef\xbf\xbd\xef\xbf\xbdx5xguyqxnk'
     signed_value = 'a91158022d377c3c:SDuvZS7k8XmYV2vmdBeHCOyTAPgiscph3n0dv\xef\xbf\xbd\xef\xbf\xbdx5xguyqxnk'
     value = 'a91158022d377c3c'

  File "/usr/lib/python2.7/dist-packages/wcs/qommon/sessions.py", line 305, in get_tempfile
   303             value = signer.unsign(token)
   304         except BadSignature:
>  305             return None
   306         dirname = os.path.join(get_publisher().app_dir, 'tempfiles')
   307         filename = os.path.join(dirname, value + '.json')

  locals:
     self = <Session at 7eff97c8e0d0: 5ce1d48be903a889>
     signer = <django.core.signing.Signer object at 0x7eff97f58c10>
     token = 'a91158022d377c3c:SDuvZS7k8XmYV2vmdBeHCOyTAPgiscph3n0dv\xef\xbf\xbd\xef\xbf\xbdx5xguyqxnk'

  File "/usr/lib/python2.7/dist-packages/wcs/qommon/sessions.py", line 321, in get_tempfile_content
   319
   320     def get_tempfile_content(self, token):
>  321         temp = self.get_tempfile(token)
   322         if not temp:
   323             return temp

Lors du signer.unsign(token) il faudrait vérifier que token est bien en ascii... enfin je pense.

#2

Mis à jour par Frédéric Péters il y a presque 5 ans

Sans finesse.

#3

Mis à jour par Thomas Noël il y a presque 5 ans

  • Statut changé de Solution proposée à Solution validée
#4

Mis à jour par Frédéric Péters il y a presque 5 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit 0bd83cf752781936448c36beb2b0887705e1c139
Author: Frédéric Péters <fpeters@entrouvert.com>
Date:   Tue May 21 12:31:32 2019 +0200

    sessions: protect against non-ascii signatures (#33085)
#5

Mis à jour par Frédéric Péters il y a presque 5 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF