Skip to content

Security: fix XSS and path traversal in uicore templatetags#1510

Open
davmlaw wants to merge 1 commit intomasterfrom
security/uicore-xss-fixes
Open

Security: fix XSS and path traversal in uicore templatetags#1510
davmlaw wants to merge 1 commit intomasterfrom
security/uicore-xss-fixes

Conversation

@davmlaw
Copy link
Copy Markdown
Contributor

@davmlaw davmlaw commented Apr 2, 2026

Fixes items from security review SACGF/variantgrid_private#3832.

Changes

  • menu_bar_main.html{{ user.username|escapejs }} in JS string context; prevents XSS if a username ever contains a single quote
  • ui_utils.py severity_iconhtml.escape(title) for the title HTML attribute; prevents attribute breakout
  • ui_help.py page_help — validates page_id against [\w\-]+ before using it in a file path; prevents path traversal

Items not fixed (already safe or out of scope)

  • tabs.html open redirectresolved_url is only set when content.startswith('/') (see ui_tabs_builder.py:222), so external URLs are already rejected
  • admin_link.html info disclosure — the tag already returns {} for non-superusers before is_admin is ever set; the warning is superuser-only
  • help.html | safe — intentional; content is from static files or rendered template nodelists (developer-controlled), not user input
  • Inline <script> blocks — CSP backlog item, no immediate security impact

…iantgrid_private#3832

- escapejs on user.username in JS string context (menu_bar_main.html)
- html.escape() on title attribute in severity_icon filter (ui_utils.py)
- Validate page_id with whitelist regex in page_help tag (ui_help.py)
@davmlaw davmlaw force-pushed the security/uicore-xss-fixes branch from db139c5 to 7974224 Compare April 2, 2026 00:35
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