Maintenance Notes Interpret HTML-Like Text as Markup
Level 2 · node · Security · Missing HTML output encoding for maintenance note bodies
Scenario
A fictional facility maintenance board renders operator notes as an HTML list. Notes are plain text, so strings resembling tags must remain visible as text. The current service inserts stored note bodies directly into HTML, allowing user-supplied markup to be interpreted by a browser. Inspect the repository, service, and controller rendering flow.
Requirements
Encode special characters in note bodies for safe HTML text-node output. Preserve normal note order, board isolation, rejection of empty notes, and empty results for unknown boards. Add no external packages or network calls.
Acceptance criteria
- Plain notes appear in an HTML list in insertion order.
- Angle brackets in note text are displayed as text, not interpreted as HTML tags.
- Ampersands and quotation marks in note bodies are converted to safe HTML entities.
- Empty notes are rejected without changing existing records.
- Notes remain isolated between boards.
- An unknown board returns an empty list.