Skip to content

refactor: evaluate compile-time template engine for UI #485

Description

@devitway

Problem

ui/templates.rs (1859 lines) and ui/components.rs (947 lines) generate HTML via format!() string concatenation with manual html_escape() calls. No compile-time verification of HTML structure or auto-escaping.

Risk

Missing a single html_escape() on user-controlled data (artifact names, versions) creates an XSS vector. Manual escaping is error-prone as the UI grows.

Options

Engine Approach Binary size Compile-time safe
askama Jinja2-like templates, compile-time ~0 runtime Yes
maud Rust macros as HTML ~0 runtime Yes
tera Runtime templates +200KB No
Current format!() strings 0 No

Notes

This is a significant refactoring (2800+ lines). The current approach works and has no known XSS (all escape points are covered by tests). This is about long-term maintainability, not an urgent fix.

Evaluate whether the migration cost justifies the safety benefit given that UI is a secondary feature of NORA.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium prioritydiscussionOpen discussion — not yet a planned featurerefactoringCode quality and idiomatic improvements

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions