mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Handle binascii.Error from base64.b64decode()
In Python 3, the base64.b64decode function raises binascii.Error (a ValueError subclass) when it finds incorrect padding. In Python 2 it raises TypeError. Callers should usually handle ValueError; unless they are specifically concerned with handling base64 padding issues). In some cases, callers should handle ValueError: - ipalib.pkcs10 (get_friendlyname, load_certificate_request): callers should handle ValueError - ipalib.x509 (load_certificate*, get_*): callers should handle ValueError In other cases ValueError is handled: - ipalib.parameters - ipapython.ssh - ipalib.rpc (json_decode_binary - callers already expect ValueError) - ipaserver.install.ldapupdate Elsewhere no error handling is done, because values come from trusted sources, or are pre-validated: - vault plugin - ipaserver.install.cainstance - ipaserver.install.certs - ipaserver.install.ipa_otptoken_import Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
committed by
Martin Basti
parent
92a4b18fc2
commit
eab334dde8
@@ -102,7 +102,7 @@ class SSHPublicKey(object):
|
||||
|
||||
try:
|
||||
key = base64.b64decode(key)
|
||||
except (TypeError, binascii.Error):
|
||||
except (TypeError, ValueError):
|
||||
return False
|
||||
|
||||
return self._parse_raw(key)
|
||||
|
||||
Reference in New Issue
Block a user