Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 84634a2

Browse filesBrowse files
committed
Reword
1 parent a1d7e49 commit 84634a2
Copy full SHA for 84634a2

File tree

1 file changed

+8
-2
lines changed
Filter options

1 file changed

+8
-2
lines changed

‎security/csrf.rst

Copy file name to clipboardExpand all lines: security/csrf.rst
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,10 @@ object evaluated to the id::
288288
// ... do something, like deleting an object
289289
}
290290

291-
You can use the ``methods`` parameter to the attribute to specify the HTTP methods that are allowed for
292-
the token validation, :class:`Symfony\\Component\\Security\\Http\\Attribute\\IsCsrfTokenValid` is ignored for other methods. By default, the attribute allows all methods::
291+
By default, the ``IsCsrfTokenValid`` attribute performs the CSRF token check for
292+
all HTTP methods. You can restrict this validation to specific methods using the
293+
``methods`` parameter. If the request uses a method not listed in the ``methods``
294+
array, the attribute is ignored for that request, and no CSRF validation occurs::
293295

294296
#[IsCsrfTokenValid('delete-item', tokenKey: 'token', methods: ['DELETE'])]
295297
public function delete(Post $post): Response
@@ -302,6 +304,10 @@ the token validation, :class:`Symfony\\Component\\Security\\Http\\Attribute\\IsC
302304
The :class:`Symfony\\Component\\Security\\Http\\Attribute\\IsCsrfTokenValid`
303305
attribute was introduced in Symfony 7.1.
304306

307+
.. versionadded:: 7.3
308+
309+
The ``methods`` parameter was introduced in Symfony 7.3.
310+
305311
CSRF Tokens and Compression Side-Channel Attacks
306312
------------------------------------------------
307313

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.