Skip to content

Commit 19de81b

Browse files
committed
docs: add sub section titles
1 parent 5bbf3af commit 19de81b

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

  • user_guide_src/source/outgoing

user_guide_src/source/outgoing/csp.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ Inline Content
8888

8989
It is possible to set a website to not protect even inline scripts and styles on its own pages, since this might have
9090
been the result of user-generated content. To protect against this, CSP allows you to specify a nonce within the
91-
``<style>`` and ``<script>`` tags, and to add those values to the response's header. This is a pain to handle in real
91+
``<style>`` and ``<script>`` tags, and to add those values to the response's header.
92+
93+
Using Placeholders
94+
==================
95+
96+
This is a pain to handle in real
9297
life, and is most secure when generated on the fly. To make this simple, you can include a ``{csp-style-nonce}`` or
9398
``{csp-script-nonce}`` placeholder in the tag and it will be handled for you automatically::
9499

@@ -109,7 +114,13 @@ life, and is most secure when generated on the fly. To make this simple, you can
109114

110115
.. warning:: If an attacker injects a string like ``<script {csp-script-nonce}>``, it might become the real nonce attribute with this functionality. You can customize the placeholder string with the ``$scriptNonceTag`` and ``$styleNonceTag`` properties in **app/Config/ContentSecurityPolicy.php**.
111116

112-
If you don't like this auto replacement functionality, you can turn it off with setting ``$autoNonce = false`` in **app/Config/ContentSecurityPolicy.php**.
117+
.. _csp-using-functions:
118+
119+
Using Functions
120+
===============
121+
122+
If you don't like the auto replacement functionality above, you can turn it off
123+
with setting ``$autoNonce = false`` in **app/Config/ContentSecurityPolicy.php**.
113124

114125
In this case, you can use the functions, :php:func:`csp_script_nonce()` and :php:func:`csp_style_nonce()`::
115126

0 commit comments

Comments
 (0)