Skip to content

[Low] Literal </template> in app-rendered raw HTML breaks the streaming wrapper #54

Description

@thinkter

Security audit finding, commit abf4e87.

File: src/core/render.ts:122-124 (streamSwap), src/core/render.ts:307-310 (metadataSwap)

Attack / Failure scenario

streamSwap embeds rendered page HTML inside <template>...</template> without transformation. If app-rendered raw HTML contains a literal </template>, it closes the wrapper early, and everything after it becomes sibling content outside the intended slot — breaking the streaming swap.

Properly escaped user data is unaffected; this only bites app code that emits a raw literal </template> in page output.

Suggested fix

Ensure the wrapped payload cannot contain a raw </template>:

  • document the constraint for app authors, and/or
  • escape/segment the payload or use a sentinel-delimited delivery so a literal </template> in content cannot terminate the wrapper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: streamingrenderPipelineStreaming / progressive enhancement under streamsbugSomething isn't workingseverity: low-hangingPolish, tech debt, missing docs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions