Skip to content

[Security] Form authentication throws error on non string username #25612

@zlikavac32

Description

@zlikavac32
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.4

\Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener trusts that submitted data will contain string as username.

In case that provided data is array, trim (that's used on the input values) will throw trim() expects parameter 1 to be string, array given which results in a 500 status code.

Simple CURL that causes this behaviour would look like this:

curl \
    'http://127.0.0.1:8080/app_dev.php/login_check' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    --data '_username%5Bname%5D=user&_password=pass'

One quick solution would be to cast before passing to trim but perhaps some use of validator component would be a better approach?

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