8000 [Security] Potential BC break with guard::start() returning nothing · Issue #34357 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Security] Potential BC break with guard::start() returning nothing #34357
Closed
@lyrixx

Description

@lyrixx

Symfony version(s) affected: 4.4-BETA2

Description

I updated an application to 4.4-BETA2 and I have a failing test (only one!).
I request the API entrypoint without credential, and I assert it returns a 401.
With SF 4.3 => OK
With SF 4.4 => KO, I got a 200

How to reproduce

I created 2 new projets with the website skeleton. One on 4.4 and one on 4.3 and I create an empty guard + a controller (thanks to maker bundle). Then I updated the security to:

security:
    firewalls:
        main:
            pattern: ^/
            stateless: true
            anonymous: false
            guard:
                authenticators:
                    - App\Security\AppCustomAuthenticator

So I'm expecting a 401 when no credential are present in the request because of anonymous: false.

With Symfony 4.4 => 200
With Symfony 4.3 => 500 : The App\Security\AppCustomAuthenticator::start() method must return a Response object (NULL returned)

Possible Solution

I'm not sure my application has the same side effect, I will dig.
But anyway, with anonymous=false, I expect to throw a 401 when the credentials are not present (and so the authentication is not done)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0