Skip to content

Fix XSS and crash bugs in admin UI#4

Open
yannmh wants to merge 1 commit into
masterfrom
yannmh/fix-critical-bugs-6d2m2y
Open

Fix XSS and crash bugs in admin UI#4
yannmh wants to merge 1 commit into
masterfrom
yannmh/fix-critical-bugs-6d2m2y

Conversation

@yannmh

@yannmh yannmh commented Apr 20, 2026

Copy link
Copy Markdown
Owner

Summary

Three critical bug fixes surfaced by an audit of the admin web UI JS:

  • XSS via X-Forwarded-For (scripts/js/settings-api.js:118) — the value was interpolated into HTML via .html() with no escaping. An attacker able to set the X-Forwarded-For header on a session could render arbitrary HTML/JS inside the API sessions table. Fixed by wrapping with utils.escapeHtml.
  • XSS via API error message (scripts/js/utils.js:339) — alCustomErr.html(response.message) rendered the API's error string as HTML in the "add to list" modal. Switched to .text().
  • Crash on teleporter download (scripts/js/settings-teleporter.js:93) — xhr.getResponseHeader("Content-Disposition").match(...)[1] threw when the header was missing or didn't match the regex, breaking the download. Added null/undefined guards and a fallback filename.

Test plan

  • Admin sessions table still displays the forwarded address; confirm a value like <img src=x onerror=alert(1)> renders as text, not HTML.
  • Adding a query-log entry to a list on failure shows the API error message as plain text.
  • Teleporter export still downloads with the backend-supplied filename; works even if the Content-Disposition header is stripped by a proxy.

🤖 Generated with Claude Code
🌒 Run on Niteshift: View Task

- settings-api.js: escape x_forwarded_for before injecting into HTML; an
  attacker-controllable X-Forwarded-For header could otherwise be rendered
  as HTML in the admin sessions table.
- utils.js: render API error messages with .text() instead of .html() in
  the "add to list" alert modal to prevent injection via response.message.
- settings-teleporter.js: guard against a missing/malformed
  Content-Disposition header when downloading the teleporter archive;
  previously .match(...)[1] would throw and break the download.

Run-on: Niteshift

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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