Skip to content

Commit ce506f3

Browse files
committed
bug #19373 [Form] Skip CSRF validation on form when POST max size is exceeded (jameshalsall)
This PR was squashed before being merged into the 2.7 branch (closes #19373). Discussion ---------- [Form] Skip CSRF validation on form when POST max size is exceeded | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #19140 | License | MIT | Doc PR | N/A In #19140 the CSRF validation listener was not aware that the POST max size had exceeded, and was adding a form error message that wasn't relevant to the actual error. This introduces the `ServerParams` utility class into the `CsrfValidationListener` and checks that the POST max size has not been exceeded. If it has then it won't bother trying to validate the CSRF token. My main concern with this change is that it opens up an attack vector around tokens, but I've encapsulated the request size validation in a single method in `ServerParams` now so that the request handlers are using the same logic. Commits ------- 289531f [Form] Skip CSRF validation on form when POST max size is exceeded
2 parents c1fefb6 + 6e7973f commit ce506f3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Resources/config/form_csrf.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<argument>%form.type_extension.csrf.field_name%</argument>
1717
<argument type="service" id="translator.default" />
1818
<argument>%validator.translation_domain%</argument>
19+
<argument type="service" id="form.server_params" />
1920
</service>
2021
</services>
2122
</container>

0 commit comments

Comments
 (0)