-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Documented the "autoescape" TwigBundle config option #6539
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,28 @@ If ``true``, whenever a template is rendered, Symfony checks first if its source | |
code has changed since it was compiled. If it has changed, the template is | ||
compiled again automatically. | ||
|
||
autoescape | ||
~~~~~~~~~~ | ||
|
||
**type**: ``boolean`` or ``string`` **default**: ``'filename'`` | ||
|
||
If set to ``true``, all template contents are escaped for HTML. If set to | ||
``false``, no escaping is applied automatically (you can still escape each | ||
content individually in the templates). | ||
|
||
.. caution:: | ||
|
||
Setting this option to ``false`` is dangerous and it will make your | ||
application vulnerable to XSS exploits because most third-party bundles | ||
assume that auto-escaping is enabled and they don't escape contents | ||
themselves. | ||
|
||
If set to a string, template contents are escaped using the strategy with that | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'm missing "the" before "template contents", not 100% sure though but it feels more correct |
||
name. Allowed values are ``html``, ``js``, ``css``, ``url`` and ``html_attr``. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please also add the default value in the allowed values list |
||
A special strategy called ``filename`` is used by default and it escapes contents | ||
according to the filename extension (it uses ``html`` for ``*.html.twig`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "[...] (e.g. it uses |
||
templates, ``js`` for ``*.js.html`` templates, etc.) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what about adding a ref to the next option, allowing people to use a custom strategy? |
||
|
||
autoescape_service | ||
~~~~~~~~~~~~~~~~~~ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"If set to
false
, automatic escaping is disabled (you can still [...]" ?