Skip to content

dashboard/index.html's esc() helper does not escape HTML, and two innerHTML sites rely on it

Id: TD-PPagop-26082409 · Status: resolved · Filed: 2026-08-24 · Resolved: 2026-09-08 · Ref: https://github.com/Pullwright/agent-ops/pull/1277 · Review: reviews/project-review-2026-08-23 R-04 F-SEC-02

Severity: Medium

dashboard/index.html:307 — function esc(s) { return String(s == null ? "" : s); } — performs no HTML-entity escaping despite its name. Most call sites are safe only because they flow into document.createTextNode via el()’s children path. Two call sites flow into innerHTML via the html: attribute: kv() (~line 1782, el("span", {..., html: k + " <b>" + esc(v) + "</b>"})) and a count-summary string (~line 2063). Today both only carry pipeline-internal values — no live XSS exists — but the function’s name actively invites a future developer to trust it with content that could be attacker-influenced (an issue/PR title, a model-generated reason string).

Likely arose because the function was originally written when only trusted, pipeline-internal strings passed through it, and its name was never revisited as call sites accumulated.

Ongoing cost: low today (no live XSS), but it is a broken abstraction that invites a future stored-XSS regression on a page exposed to everyone on the operator’s Tailscale network, since a developer trusting esc()’s name has no signal that it does nothing.

Suggested fix: rewrite kv() (and the count-summary site, if practical) to build its markup via el()-based DOM construction instead of string-concatenating into innerHTML, removing the unsafe site entirely; or, if a genuine html: use remains, rename esc() to something that doesn’t imply escaping (e.g. str()) and write a real escaper for the one site that needs it.

Migrated to https://github.com/Poetic-Poems/agent-ops/issues/965.