Skip to content

Check that nested-template attribute values are escaped on the node render path #702

Closed

Description

@JuroOravec

The question

On the node render path, is a nested-template attribute value on a plain HTML element escaped as attribute text?

What happens today

Ordinary renders format the rendered value with format_attrs, which escapes it; packages/py/citry/tests/test_nodes.py:215-231 locks that (body="<span>hi</span>").

The older node classes run only for templates that embed spans of another template language (foreign spans, the experimental host-template embedding, packages/py/citry/citry/component_render.py:3053-3062). There, the branch of ElementAttrsNode._format (packages/py/citry/citry/nodes/__init__.py:1513-1518) writes name=", then the rendered value as a child part, then ". No attribute escape is visible in that code. {{ }} values inside the nested template are still HTML-escaped, so request data cannot leave the attribute, but Markup, slot or child output that contains " might.

This was found by reading the code; nothing was run.

Next step

One test that renders c-title="<>...</>" on a template with a foreign span would settle it. If the value is not escaped, route it through format_attrs like the ordinary path.

Found while writing the trust-boundary design doc for #603.

🤖 Generated with Claude Code

Activity

  1. added
    next-sprint
    on Nov 15, 2026
  2. added this to the 1.1.0 milestone on Nov 15, 2026
  3. JuroOravec commented on Nov 18, 2026

    @JuroOravec
    MemberAuthor

    Fixed in citry 1.0.1 (commit 5d07a7d and the commit after it). The details are in GHSA-gv5c-rm2r-mvp5 and, for a Django SafeString, GHSA-v7q5-qfrw-rhqc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    next-sprint

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions