Skip to content

Commit 99ef79b

Browse files
authored
Merge pull request #8166 from kenjis/docs-csrf-cookie-warning
docs: add warning on CSRF cookie and redirect()
2 parents 97e0292 + 79ec269 commit 99ef79b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

user_guide_src/source/libraries/security.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ Token Regeneration
107107
------------------
108108

109109
Tokens may be either regenerated on every submission (default) or
110-
kept the same throughout the life of the CSRF cookie. The default
110+
kept the same throughout the life of the Session or CSRF cookie.
111+
112+
The default
111113
regeneration of tokens provides stricter security, but may result
112114
in usability concerns as other tokens become invalid (back/forward
113115
navigation, multiple tabs/windows, asynchronous actions, etc). You
@@ -116,6 +118,10 @@ may alter this behavior by editing the following config parameter value in
116118

117119
.. literalinclude:: security/004.php
118120

121+
.. warning:: If you use Cookie based CSRF protection, and :php:func:`redirect()`
122+
after the submission, you must call ``withCookie()`` to send the regenerated
123+
CSRF cookie. See :ref:`response-redirect` for details.
124+
119125
.. note:: Since v4.2.3, you can regenerate CSRF token manually with the
120126
``Security::generateHash()`` method.
121127

0 commit comments

Comments
 (0)