CVE-2023-46734: Potential XSS vulnerabilities in CodeExtension filters


Affected versions
Symfony versions >=2.0.0,<4.4.51, >=5.0.0,<5.4.31, and =6.0.0,<6.3.8 of the
Symfony Twig Bridge are affected by this security issue.
The issue has been fixed in Symfony 4.4.51, 5.4.31, 6.3.8. All other versions are not maintained anymore.

Description
Some filters in the CodeExtension Twig extension use is_safe=html but
they don't actually ensure their input is safe.
CodeExtension is an internal Twig extension that should be only used in
development environments. You might be affected only if you are using this
extension explicitly in production environments.
As of Symfony 6.4, this extension has been marked as @internal.

Resolution
Symfony now escapes the output of the affected filters.
The patch for this issue is available here
for branch 4.4.

Credits
We would like to thank Pierre Rudloff for reporting the issue and to Nicolas Grekas for providing the fix.

Sponsor the Symfony project.