https://dev.entrouvert.org/https://dev.entrouvert.org/favicon.ico?15861920342019-03-06T20:52:41ZRedmine Entr’ouvertAuthentic 2 - Development #31180: python3 : choisir la bonne exception à détecter dans le test authn OIDC de décodage en base64 de URLhttps://dev.entrouvert.org/issues/31180?journal_id=1603002019-03-06T20:52:41ZPaul Marillonnet
<ul><li><strong>Fichier</strong> <a href="/attachments/32355">0001-python3-pick-url-b64-decoding-exception-in-oidc-auth.patch</a> <a class="icon-only icon-download" title="Télécharger" href="/attachments/download/32355/0001-python3-pick-url-b64-decoding-exception-in-oidc-auth.patch">0001-python3-pick-url-b64-decoding-exception-in-oidc-auth.patch</a> ajouté</li><li><strong>Tracker</strong> changé de <i>Support</i> à <i>Development</i></li><li><strong>Statut</strong> changé de <i>Nouveau</i> à <i>Solution proposée</i></li><li><strong>Patch proposed</strong> changé de <i>Non</i> à <i>Oui</i></li></ul> Authentic 2 - Development #31180: python3 : choisir la bonne exception à détecter dans le test authn OIDC de décodage en base64 de URLhttps://dev.entrouvert.org/issues/31180?journal_id=1603782019-03-06T21:28:41ZPaul Marillonnet
<ul><li><strong>Lié à</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/28276">Development #28276</a>: Fonctionner avec Python3 pour Django1.11</i> ajouté</li></ul> Authentic 2 - Development #31180: python3 : choisir la bonne exception à détecter dans le test authn OIDC de décodage en base64 de URLhttps://dev.entrouvert.org/issues/31180?journal_id=1636082019-03-25T09:56:13ZBenjamin Dauvergne
<ul><li><strong>Assigné à</strong> mis à <i>Paul Marillonnet</i></li></ul> Authentic 2 - Development #31180: python3 : choisir la bonne exception à détecter dans le test authn OIDC de décodage en base64 de URLhttps://dev.entrouvert.org/issues/31180?journal_id=1650012019-04-01T09:45:28ZBenjamin Dauvergne
<ul></ul><p>Il y en a d'autres, je propose de tous les corriger peut-être en inventant une Base64Error dans <code>authentic2.compat</code> qui prendra le bon type.</p>
<pre>
bdauvergne@revestel:~/wd/eo/authentic$ git grep -C10 TypeError | grep -C4 b64
src/authentic2/crypto.py- if raise_on_error:
src/authentic2/crypto.py- raise DecryptionError('bad payload')
src/authentic2/crypto.py- return None
src/authentic2/crypto.py- try:
src/authentic2/crypto.py- iv = base64.b64decode(iv)
src/authentic2/crypto.py- crypted = base64.b64decode(crypted)
src/authentic2/crypto.py: except TypeError:
src/authentic2/crypto.py- if raise_on_error:
src/authentic2/crypto.py- raise DecryptionError('incorrect base64 encoding')
src/authentic2/crypto.py- return None
--
src/authentic2/nonce/utils.py-
src/authentic2/nonce/utils.py-def unlink_if_exists(path):
src/authentic2/nonce/utils.py- try:
--
src/authentic2/profile_views.py- uidb64 = kwargs['uidb64']
src/authentic2/profile_views.py- self.token = token = kwargs['token']
src/authentic2/profile_views.py-
src/authentic2/profile_views.py- UserModel = get_user_model()
src/authentic2/profile_views.py- # checked by URLconf
src/authentic2/profile_views.py- assert uidb64 is not None and token is not None
src/authentic2/profile_views.py- try:
src/authentic2/profile_views.py- uid = urlsafe_base64_decode(uidb64)
src/authentic2/profile_views.py- # use authenticate to eventually get an LDAPUser
src/authentic2/profile_views.py- self.user = authenticate(user=UserModel._default_manager.get(pk=uid))
src/authentic2/profile_views.py: except (TypeError, ValueError, OverflowError,
src/authentic2/profile_views.py- UserModel.DoesNotExist):
--
src/authentic2/saml/saml2utils.py- if boolean is False:
src/authentic2/saml/saml2utils.py- return 'false'
src/authentic2/saml/saml2utils.py: raise TypeError()
src/authentic2/saml/saml2utils.py-
src/authentic2/saml/saml2utils.py-def int_to_b64(i):
src/authentic2/saml/saml2utils.py- h = hex(i)[2:].strip('L')
src/authentic2/saml/saml2utils.py- if len(h) % 2 == 1:
src/authentic2/saml/saml2utils.py- h = '0' + h
src/authentic2/saml/saml2utils.py- return base64.b64encode(binascii.unhexlify(h))
src/authentic2/saml/saml2utils.py-
src/authentic2/saml/saml2utils.py-def keyinfo(tb, key):
src/authentic2/saml/saml2utils.py- tb.pushNamespace(lasso.DS_HREF)
src/authentic2/saml/saml2utils.py- tb.start('KeyInfo', {})
--
src/authentic2_idp_oidc/views.py- authorization = request.META['HTTP_AUTHORIZATION'].split()
src/authentic2_idp_oidc/views.py- if authorization[0] != 'Basic' or len(authorization) != 2:
src/authentic2_idp_oidc/views.py- return None
src/authentic2_idp_oidc/views.py- try:
src/authentic2_idp_oidc/views.py- decoded = base64.b64decode(authorization[1])
src/authentic2_idp_oidc/views.py: except TypeError:
src/authentic2_idp_oidc/views.py- return None
src/authentic2_idp_oidc/views.py- parts = decoded.split(':')
src/authentic2_idp_oidc/views.py- if len(parts) != 2:
--
tests/test_idp_saml2.py- '%s/sso/POST' % self.base_url)
tests/test_idp_saml2.py- self.assertIn('SAMLResponse', doc.forms[0].fields)
tests/test_idp_saml2.py- saml_response = doc.forms[0].fields['SAMLResponse']
tests/test_idp_saml2.py- try:
tests/test_idp_saml2.py- base64.b64decode(saml_response)
tests/test_idp_saml2.py: except TypeError:
tests/test_idp_saml2.py- self.fail('SAMLResponse is not base64 encoded: %s'
tests/test_idp_saml2.py- % saml_response)
tests/test_idp_saml2.py- with self.assertRaises(lasso.ProfileRequestDeniedError):
--
tests/test_idp_saml2.py- doc.forms[0].get('action'), '%s/sso/POST' % self.base_url)
tests/test_idp_saml2.py- self.assertIn('SAMLResponse', doc.forms[0].fields)
tests/test_idp_saml2.py- saml_response = doc.forms[0].fields['SAMLResponse']
tests/test_idp_saml2.py- try:
tests/test_idp_saml2.py- base64.b64decode(saml_response)
tests/test_idp_saml2.py: except TypeError:
tests/test_idp_saml2.py- self.fail('SAMLResponse is not base64 encoded: %s' % saml_response)
tests/test_idp_saml2.py- login = self.parse_authn_response(saml_response)
tests/test_idp_saml2.py- assertion = login.assertion
bdauvergne@revestel:~/wd/eo/authentic$
</pre> Authentic 2 - Development #31180: python3 : choisir la bonne exception à détecter dans le test authn OIDC de décodage en base64 de URLhttps://dev.entrouvert.org/issues/31180?journal_id=1650022019-04-01T09:45:35ZBenjamin Dauvergne
<ul><li><strong>Statut</strong> changé de <i>Solution proposée</i> à <i>En cours</i></li></ul> Authentic 2 - Development #31180: python3 : choisir la bonne exception à détecter dans le test authn OIDC de décodage en base64 de URLhttps://dev.entrouvert.org/issues/31180?journal_id=1666122019-04-09T09:25:53ZPaul Marillonnet
<ul><li><strong>Fichier</strong> <a href="/attachments/33339">0001-python3-define-a-base64-decoding-exception-31180.patch</a> <a class="icon-only icon-download" title="Télécharger" href="/attachments/download/33339/0001-python3-define-a-base64-decoding-exception-31180.patch">0001-python3-define-a-base64-decoding-exception-31180.patch</a> ajouté</li><li><strong>Statut</strong> changé de <i>En cours</i> à <i>Solution proposée</i></li></ul> Authentic 2 - Development #31180: python3 : choisir la bonne exception à détecter dans le test authn OIDC de décodage en base64 de URLhttps://dev.entrouvert.org/issues/31180?journal_id=1994032019-10-30T09:48:20ZBenjamin Dauvergne
<ul><li><strong>Statut</strong> changé de <i>Solution proposée</i> à <i>Solution validée</i></li></ul> Authentic 2 - Development #31180: python3 : choisir la bonne exception à détecter dans le test authn OIDC de décodage en base64 de URLhttps://dev.entrouvert.org/issues/31180?journal_id=2140312020-02-06T09:16:41ZPaul Marillonnet
<ul><li><strong>Statut</strong> changé de <i>Solution validée</i> à <i>Résolu (à déployer)</i></li></ul><pre>
commit 9c9db933f62bb23e65503f1883703f3deb7f327a
Author: Paul Marillonnet <pmarillonnet@entrouvert.com>
Date: Tue Apr 2 18:24:03 2019 +0200
python3: define a base64 decoding exception (#31180)
<pre></pre> Authentic 2 - Development #31180: python3 : choisir la bonne exception à détecter dans le test authn OIDC de décodage en base64 de URLhttps://dev.entrouvert.org/issues/31180?journal_id=2142962020-02-07T08:15:07ZFrédéric Pétersfpeters@entrouvert.com
<ul><li><strong>Statut</strong> changé de <i>Résolu (à déployer)</i> à <i>Solution déployée</i></li></ul>