aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/security.md
diff options
context:
space:
mode:
authorAnshul Agrawal <anshul.agrawal@urbanladder.com>2015-09-14 11:35:16 +0530
committerAnshul Agrawal <anshul.agrawal@urbanladder.com>2015-09-14 11:35:16 +0530
commit570cd2481653be3d5bc8962b4b95360c6569041b (patch)
treefdf5685e44fdff1bfd56d771ae6fba7001929afd /guides/source/security.md
parent174a57e1cb4dbd9ef60b136d2c2d380085691956 (diff)
downloadrails-570cd2481653be3d5bc8962b4b95360c6569041b.tar.gz
rails-570cd2481653be3d5bc8962b4b95360c6569041b.tar.bz2
rails-570cd2481653be3d5bc8962b4b95360c6569041b.zip
Improved explanation of the <script> tag CSRF behavior
Diffstat (limited to 'guides/source/security.md')
-rw-r--r--guides/source/security.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/guides/source/security.md b/guides/source/security.md
index 93c270064a..772a0b474c 100644
--- a/guides/source/security.md
+++ b/guides/source/security.md
@@ -245,7 +245,7 @@ Or the attacker places the code into the onmouseover event handler of an image:
<img src="http://www.harmless.com/img" width="400" height="400" onmouseover="..." />
```
-There are many other possibilities, like using a `<script>` tag to make a cross-site request to a URL with a JSONP or JavaScript response. The response is executable code that the attacker can find a way to run, possibly extracting sensitive data. To protect against this data leakage, we disallow cross-site `<script>` tags. Only Ajax requests may have JavaScript responses since `XMLHttpRequest` is subject to the browser Same-Origin policy - meaning only your site can initiate the request.
+There are many other possibilities, like using a `<script>` tag to make a cross-site request to a URL with a JSONP or JavaScript response. The response is executable code that the attacker can find a way to run, possibly extracting sensitive data. To protect against this data leakage, we disallow dynamic JS responses for anything other than ajax requests irrespective of the origin. Only Ajax requests may have JavaScript responses since `XmlHttpRequest` is subject to the browser Same-Origin policy - meaning only your site can initiate ajax requests.
To protect against all other forged requests, we introduce a _required security token_ that our site knows but other sites don't know. We include the security token in requests and verify it on the server. This is a one-liner in your application controller, and is the default for newly created rails applications: