Skip to content

Commit b6e4176

Browse files
authored
Merge pull request rails#47902 from zzak/re-47365
Add link to security guide for CSRF from JS token part
2 parents 82c609e + c34d550 commit b6e4176

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

guides/source/working_with_javascript_in_rails.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ added to the form that the `button_to` helper renders internally:
304304
When making non-GET requests from JavaScript the `X-CSRF-Token` header is required.
305305
Without this header requests won't be accepted by Rails.
306306

307+
NOTE: This token is required by Rails to prevent Cross-Site Request Forgery (CSRF) attacks. Read more in the [security guide](security.html#cross-site-request-forgery-csrf).
308+
307309
[Rails Request.JS](https://github.com/rails/request.js) encapsulates the logic
308310
of adding the request headers that are required by Rails. Just
309311
import the `FetchRequest` class from the package and instantiate it

0 commit comments

Comments
 (0)