Skip to content

fix: escapeHtml does not escape single quotes — XSS in onclick attributes #237

Description

@deucebucket

Bug

In static/js/common.js (~lines 11-16), the DOM-based escapeHtml() escapes &, <, >, and " but NOT single quotes. Throughout the codebase, escaped output is injected into single-quoted JavaScript strings inside onclick attributes:

  • library.html:574 — editBook with author/title
  • library.html:599,603 — orphan onclick handlers
  • settings.html:2831,3213,3242 — plugin management handlers

A book author like O'Brien breaks the JS string. With attacker-controlled metadata, this is an XSS vector.

Fix

Add single-quote escaping to escapeHtml().

Severity

Critical — functional breakage on common names + XSS potential.

Found via UI flow audit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsecuritySecurity vulnerability

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions