summaryrefslogtreecommitdiff
path: root/doc/source
diff options
context:
space:
mode:
authorxXx-caillou-xXx2017-11-24 14:03:37 +0100
committerjvoisin2017-11-24 14:03:37 +0100
commit5a224ee0c92d1639395d6a0c629316ae64226125 (patch)
tree8925d27e2bbfa877e9fb1fc20868fbef3d009b04 /doc/source
parent79304a29661476dc75bba07c5a83133122bbcb5c (diff)
Implement anti csrf measures
This is done by using the "samesite" cookie attribute.
Diffstat (limited to 'doc/source')
-rw-r--r--doc/source/config.rst24
-rw-r--r--doc/source/features.rst14
2 files changed, 36 insertions, 2 deletions
diff --git a/doc/source/config.rst b/doc/source/config.rst
index fc0df2d..c271403 100644
--- a/doc/source/config.rst
+++ b/doc/source/config.rst
@@ -115,6 +115,26 @@ It can either be ``enabled`` or ``disabled``.
115 sp.auto_cookie_secure.enable(); 115 sp.auto_cookie_secure.enable();
116 sp.auto_cookie_secure.disable(); 116 sp.auto_cookie_secure.disable();
117 117
118cookie_samesite
119^^^^^^^^^^^^^^^^
120 * `default: disabled`
121
122``samesite`` will add the `samesite <https://tools.ietf.org/html/draft-west-first-party-cookies-07>`_
123attribute to cookies. It `prevents CSRF <https://www.owasp.org/index.php/SameSite>`_
124but is not implemented by `all web browsers <https://caniuse.com/#search=samesite>`_ yet.
125
126It can either be set to ``strict`` or ``lax``:
127
128- The ``lax`` attribute prevents cookies from being sent cross-domain for
129 "dangerous" methods, like ``POST``, ``PUT`` or ``DELETE``.
130
131- The ``strict`` one prevents any cookies from beind sent cross-domain.
132
133::
134
135 sp.cookie.name("cookie1").samesite("lax");
136 sp.cookie.name("cookie2").samesite("strict");;
137
118.. _cookie-encryption_config: 138.. _cookie-encryption_config:
119 139
120cookie_encryption 140cookie_encryption
@@ -137,8 +157,8 @@ It can either be ``enabled`` or ``disabled`` and can be used in ``simulation`` m
137 157
138:: 158::
139 159
140 sp.cookie_encryption.cookie("my_cookie_name"); 160 sp.cookie.name("my_cookie_name").encrypt();
141 sp.cookie_encryption.cookie("another_cookie_name"); 161 sp.cookie.name("another_cookie_name").encrypt();
142 162
143Choosing the proper environment variable 163Choosing the proper environment variable
144"""""""""""""""""""""""""""""""""""""""" 164""""""""""""""""""""""""""""""""""""""""
diff --git a/doc/source/features.rst b/doc/source/features.rst
index 3643326..c4239e9 100644
--- a/doc/source/features.rst
+++ b/doc/source/features.rst
@@ -321,6 +321,20 @@ would be to use a different user to run PHP than for administrating the website,
321and using this feature to lock this up. 321and using this feature to lock this up.
322 322
323 323
324Protection against cross site request forgery
325^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
326
327Cross-site request forgery, sometimes abbreviated as *CSRF*,
328is when unauthorised commands are issued from a user that the application trusts.
329For example, if a user is authenticated on a banking website,
330an other site might present something like
331``<img src="http://mybank.com/transfer?from=user&to=attack&amount=1337EUR">``,
332effectivement transfering money from the user's account to the attacker one.
333
334Snuffleupagus can prevent this (in `supported browsers <https://caniuse.com/#search=samesite>`__)
335by setting the `samesite <https://tools.ietf.org/html/draft-west-first-party-cookies-07>`__
336attribute on cookies.
337
324 338
325Dumping capabilities 339Dumping capabilities
326^^^^^^^^^^^^^^^^^^^^ 340^^^^^^^^^^^^^^^^^^^^