Skip to content

Plan 004: Harden web UI defaults (bind address + HTML sanitization) #24

Description

@strickvl

Generated by a codebase audit on 2026-06-12 against commit 5b5c634. The full executable plan (with details and verification gates) lives locally at plans/004-frontend-security-hardening.md.

Summary

Two defensive-hardening changes to the FastHTML web UI:

  1. Bind to localhost by default. The UI currently listens on all network interfaces (src/frontend/__main__.py). Change the default to 127.0.0.1, with a HINBOX_FRONTEND_HOST env var for deliberate LAN exposure.
  2. Sanitize rendered profile HTML. Entity profile text is LLM-generated from scraped article content (untrusted input) and is currently rendered without an HTML sanitization step. Add an allowlist-based sanitizer (nh3) between markdown conversion and rendering, in a shared render_profile_html() helper used by all four entity detail routes, preserving citation superscript links.

Acceptance

  • UI listens on 127.0.0.1:5001 by default; env override documented in README
  • All profile rendering goes through the sanitizing helper; no raw markdown-to-NotStr calls remain in src/frontend/
  • New tests cover sanitization behavior and citation-link survival
  • just ci passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions