Skip to content

Authorization.from_header with "Token" scheme cannot handle base64 padding on tokens #2685

@0xDEC0DE

Description

@0xDEC0DE

Steps to reproduce

import base64
from werkzeug.datastructures.auth import Authorization
token = base64.encodebytes(b"This has base64 padding").decode("utf-8").strip()
a = Authorization.from_header(f"Token {token}")
a.token

Expected result

VGhpcyBoYXMgYmFzZTY0IHBhZGRpbmc=

Actual behavior

A NoneType is returned.

Environment:

  • Python version: Python 3.11.2 (v3.11.2:878ead1ac1, Feb 7 2023, 10:02:41) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
  • Werkzeug version: 2.3.3 / main

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions