-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
Make Base64 decoding strict by default #148204
Copy link
Copy link
Open
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Feature or enhancement
Earlier specifications of Base64 encoding (e.g. RFC 1421, RFC 2045) allowed to ignore any non-alphabetical characters, and that was the behavior of the
base64module. The later specifications (RFC 3548, RFC 4648) require that non-alphabetic characters should be errors, unless opposite is explicitly specified. The Base64 decoder in Python got the option to enable more strict behavior, and now it got option to specify what exactly characters can be ignored.I think that we should make Base64 decoding strict by default. I am not sure when we should do this, in 3.15 or in future versions. There is no reasonable way to use warnings, they would do more harm.
cc @gpshead