Skip to content

HeaderAccessTokenExtractor b64token regex not compatible with RFC #54660

@jpoliak-invia

Description

@jpoliak-invia

Symfony version(s) affected

6.4.*

Description

In Symfony\Component\Security\Http\AccessToken\HeaderAccessTokenExtractor constructor is regex to check Authorization: Bearer b64token, but this regex is not fully compatible with RFC definition https://datatracker.ietf.org/doc/html/rfc6750#section-2.1

How to reproduce

setup in security.yaml
firewalls: main: access_token: token_extractors: 'headers'

Generate Base64 token with equal mark at the end (e.g. $token = base64_encode('wrong_regexp_exmaple') )

Make a request with header Authorization: Bearer d3JvbmdfcmVnZXhwX2V4bWFwbGU=

Possible Solution

Change regex in /symfony/security-http/AccessToken/HeaderAccessTokenExtractor.php:32
'/^%s([a-zA-Z0-9\-_\+~\/\.]+)$/'
to
'/^%s([a-zA-Z0-9\-_\+~\/\.]+=*)$/'

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy