Fix hardcoded csrf field name for actions#1163
Open
michalkaczmarek-bitbag wants to merge 4 commits into
Open
Conversation
Contributor
Author
|
@loic425 Hi, please check PR. These changes are strongly related with changes Sylius/Sylius. Merge this branch is needed for continue work on bugfix in Sylius. Details in attached PR's |
Member
|
Could you a few tests on SyliusResourceExtensionTest? |
Contributor
Author
I added tests. You can check @loic425 |
loic425
approved these changes
May 18, 2026
Contributor
Author
|
@loic425 I add one more change in ResourceController. I change visibility variable from private to protected to child classes they can inherit this variable (csrf_parameter) |
This was referenced May 18, 2026
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes hardcoded
_csrf_tokenfield name inResourceControlleractions.The field name is now configurable, allowing applications to customize the
CSRF token parameter expected in request bodies.
Problem
ResourceController::deleteAction(),bulkDeleteAction(), andapplyStateMachineTransitionAction()had_csrf_tokenhardcoded as therequest field name. Applications that need to use a different field name
(e.g. to avoid collisions or follow internal conventions) had no way to
override it.
Solution
Added a new configuration option with
_csrf_tokenas default — fullybackward compatible.