Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the _token_check logic #7233

Merged
merged 3 commits into from
May 24, 2024
Merged

Fix the _token_check logic #7233

merged 3 commits into from
May 24, 2024

Conversation

leofeyer
Copy link
Member

@leofeyer leofeyer commented May 23, 2024

This is how the RequestTokenListener currently works:

  • Check the request token if it is a Contao request and the _token_check attribute is not false.
  • Check the request token if it is not a Contao request but the _token_check attribute exists.

However, the latter case should be implemented as if the attribute is true, otherwise the request token would also be checked in the following case:

/**
 * @Route("/foo", defaults={"_token_check" = null})
 *
 * This is treated the same as "_token_check" = true, although null is falsey.
 */

The pull request also removes the redundant "_scope" = "backend", "_token_check" = true configuration, as "_token_check" = true is only required if the scope is not backend or frontend.

@leofeyer leofeyer added the bug label May 23, 2024
@leofeyer leofeyer added this to the 4.13 milestone May 23, 2024
@leofeyer leofeyer self-assigned this May 23, 2024
@leofeyer leofeyer requested a review from a team May 23, 2024 10:35
@leofeyer leofeyer changed the title Correctly implement the _token_check attribute Fix the _token_check logic May 23, 2024
@leofeyer leofeyer merged commit b370e4f into contao:4.13 May 24, 2024
18 checks passed
@leofeyer leofeyer deleted the fix/token-check branch May 24, 2024 10:10
@aschempp
Copy link
Member

aschempp commented May 27, 2024

The pull request also removes the redundant "_scope" = "backend", "_token_check" = true configuration, as "_token_check" = true is only required if the scope is not backend or frontend.

I don't think that is true? I explicitly need to disable the token check on frontend requests, e.g. on https://github.com/isotope/core/blob/2.8/system/modules/isotope/library/Isotope/Controller/PostsaleController.php#L16 !

Nevermind I misunderstood this 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants