Skip to content

[Security] Exception on empty JSON login username/password too generic #61100

@mbrodala

Description

@mbrodala

Symfony version(s) affected

7.3.1

Description

With #46118 passing an empty username/password to the JSON login was deprecated and #50866 turned this deprecation into an exception.

However, the currently thrown BadRequestHttpException is too generic. Passing an empty username/password is not a bad HTTP request, the request payload is well-formed. That an empty username/password is rejected is a requirement of the security domain. Thus an exception more specific to the security domain should be thrown instead.

How to reproduce

Try to pass an empty username or password to the JSON login.

Possible Solution

When taking #58007 into account, the JSON login could throw the BadCredentialsException instead. Or switch back to not throwing an exception at all on empty username/password since the UserBadge will throw a BadCredentialsException anyways with Symfony 8.

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