Skip to content

fix(ra.viewer): escape brand in public render API#103

Open
erayack wants to merge 1 commit into
firstbatchxyz:masterfrom
erayack:fix/escape-viewer-brand
Open

fix(ra.viewer): escape brand in public render API#103
erayack wants to merge 1 commit into
firstbatchxyz:masterfrom
erayack:fix/escape-viewer-brand

Conversation

@erayack

@erayack erayack commented Jun 12, 2026

Copy link
Copy Markdown

Summary

This fixes an HTML injection issue in the public ra.viewer rendering API.

The brand argument passed to render_page(..., brand=...) was inserted directly into the generated HTML shell, including the document <title> and page header. A crafted value could break out of those locations and inject markup or script tags.

This PR escapes the generated shell title and brand label before substitution, and adds a regression test to ensure malicious brand values remain rendered as text.

Validation

  • uv run pytest
  • uv run pytest tests/test_ra_viewer.py tests/test_viewer.py
  • uv run ruff check src/ra/viewer/html.py tests/test_ra_viewer.py
  • uv run ruff format --check src/ra/viewer/html.py tests/test_ra_viewer.py

Add a regression test for render_page shell chrome escaping so custom brands cannot inject markup into the generated viewer.
@erayack erayack force-pushed the fix/escape-viewer-brand branch from 6b3bf59 to 4af95f7 Compare June 12, 2026 20:33
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.

1 participant