Skip to content

Conversation

@koriym
Copy link
Collaborator

@koriym koriym commented Dec 22, 2025

Summary

Add Psalm taint annotations to mark Twig rendering as HTML-safe (due to Twig's autoescape feature).

Changes

  • @psalm-taint-escape html on:
    • TwigRenderer::render() - Twig autoescapes by default
    • ErrorPagerRenderer::render() - Error page rendering

This allows Psalm's taint analysis to understand that data passing through Twig templates is properly escaped for HTML output.

Test Plan

  • Run ./vendor/bin/psalm --taint-analysis to verify annotations work
  • Existing tests pass

This commit adds Psalm taint escape annotations for HTML security:

- TwigRenderer::render: marks Twig rendering as HTML escape
- ErrorPagerRenderer::render: marks error page rendering as HTML escape

Twig's autoescape feature automatically escapes HTML entities in
template output, making these methods safe sinks for HTML-tainted data.
@koriym koriym merged commit 7ee1b66 into 2.x Dec 28, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants