Skip to content

docs: move CSRF Protection Methods section up #5275

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

Merged
merged 1 commit into from
Nov 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions user_guide_src/source/libraries/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ Cross-site request forgery (CSRF)
.. warning:: The CSRF Protection is only available for **POST/PUT/PATCH/DELETE** requests.
Requests for other methods are not protected.

CSRF Protection Methods
=======================

By default, the Cookie based CSRF Protection is used. It is
`Double Submit Cookie <https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#double-submit-cookie>`_
on OWASP Cross-Site Request Forgery Prevention Cheat Sheet.

You can also use Session based CSRF Protection. It is
`Synchronizer Token Pattern <https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#synchronizer-token-pattern>`_.

You can set to use the Session based CSRF protection by editing the following config parameter value in
**app/Config/Security.php**::

public $csrfProtection = 'session';

Enable CSRF Protection
======================

Expand Down Expand Up @@ -130,22 +145,6 @@ than simply crashing. This can be turned off by editing the following config par

Even when the redirect value is ``true``, AJAX calls will not redirect, but will throw an error.

=======================
CSRF Protection Methods
=======================

By default, the Cookie based CSRF Protection is used. It is
`Double Submit Cookie <https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#double-submit-cookie>`_
on OWASP Cross-Site Request Forgery Prevention Cheat Sheet.

You can also use Session based CSRF Protection. It is
`Synchronizer Token Pattern <https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#synchronizer-token-pattern>`_.

You can set to use the Session based CSRF protection by editing the following config parameter value in
**app/Config/Security.php**::

public $csrfProtection = 'session';

*********************
Other Helpful Methods
*********************
Expand Down