8000 Fix double escaping of the decision attributes in the profiler · symfony/symfony@bc1f084 · GitHub
[go: up one dir, main page]

Skip to content

Commit bc1f084

Browse files
committed
Fix double escaping of the decision attributes in the profiler
A ternary operator is considered safe by the Twig auto-escaping only when both branches are safe. But this ternary was safe only in the ELSE branch, causing it to be unsafe. This triggered a double-escaping of the value (escaping the output of the dump). The fix is to use a {% if %} and 2 separate output statements, allowing them to be auto-escaped separately.
1 parent ba41e70 commit bc1f084

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,13 @@
257257
: '<span class="label status-error same-width">DENIED</span>'
258258
}}
259259
</td>
260-
<td>{{ decision.attributes|length == 1 ? decision.attributes|first : profiler_dump(decision.attributes) }}</td>
260+
<td>
261+
{% if decision.attributes|length == 1 %}
262+
{{ decision.attributes|first }}
263+
{% else %}
264+
{{ profiler_dump(decision.attributes) }}
265+
{% endif %}
266+
</td>
261267
<td>{{ profiler_dump(decision.object) }}</td>
262268
</tr>
263269
{% endfor %}

0 commit comments

Comments
 (0)
0