python / python/cpython

Make Base64 decoding strict by default

Open
#148,204 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extension-modules stdlib type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

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 base64 module. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the base64 module's current decoding options and the RFC 3548 and RFC 4648 requirements described in the issue. Determine the compatibility and release-policy implications of changing the default, including whether the change belongs in Python 3.15 or a later version. Done means a decided default behavior and an agreed migration or compatibility plan.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.