Skip to content

fix(web): escape loadpoint HTML and ship Leaflet on the box - #910

Merged
frahlg merged 2 commits into
masterfrom
agent/web-escape-and-vendor-leaflet
Aug 14, 2026
Merged

frahlg merged 2 commits into
masterfrom
agent/web-escape-and-vendor-leaflet

Conversation

@frahlg

@frahlg frahlg commented Aug 13, 2026

Copy link
Copy Markdown
Member

Summary

Two holes in the box UI, neither of them LAN login.

XSS. loadpoints.js wrote vehicle names, planner reasons and loadpoint ids into innerHTML with no escape. A charger or vehicle name that contains markup would run in the dashboard origin. The heat-pump card already escapes; this panel did not.

CDN script. Settings → Weather loaded Leaflet from unpkg. Three.js and Ace are already vendored so the box does not execute third-party JS. Leaflet now lives at web/vendor/leaflet/ (1.9.4) and loads from /vendor/leaflet/.

Map tiles still come from OpenStreetMap when someone opens the weather tab. That can leak location. It does not run foreign script.

Test plan

  • node --test web/loadpoints-xss.test.mjs web/leaflet-vendor.test.mjs web/loadpoint-battery-boost.test.mjs web/javascript-syntax.test.mjs
  • Advanced mode → Loadpoints: cards still render
  • Settings → Weather: map loads, marker still drags (needs a human look; CODEOWNERS)

Out of scope

  • Login on the LAN
  • API GET protection for config, logs, dumps
  • Clickjacking headers (separate PR)

frahlg added 2 commits August 14, 2026 08:03
Stop interpolating vehicle and planner strings into innerHTML.
Load the weather map from /vendor/leaflet so the box does not
run script from unpkg.
@frahlg
frahlg force-pushed the agent/web-escape-and-vendor-leaflet branch from f96fbe3 to 03459a3 Compare August 14, 2026 06:04
@frahlg
frahlg merged commit a00c512 into master Aug 14, 2026
14 checks passed
@frahlg
frahlg deleted the agent/web-escape-and-vendor-leaflet branch August 17, 2026 18:18
HuggeK added a commit to HuggeK/ftw that referenced this pull request Aug 29, 2026
…a CDN

Upstream ships Leaflet on the box (srcfl#910) for a reason that applies just as
hard to its replacement: the box UI must not execute third-party JS from a
CDN, and the map must load when the gateway cannot reach the internet. So
MapLibre GL JS 6.0.0 moves into web/vendor/maplibre — the ESM entry, its
code-split chunk, its worker, the stylesheet and the license — and the
loader imports it same-origin, which also spares MapLibre its blob: worker
detour. The now-unused vendored Leaflet goes away with its test;
maplibre-vendor.test.mjs pins the new contract, including the per-request
referrerPolicy opt-in that keeps OSM volunteer tile servers from 403ing
under the box's Referrer-Policy: no-referrer.

Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
HuggeK added a commit to HuggeK/ftw that referenced this pull request Sep 2, 2026
…a CDN

Upstream ships Leaflet on the box (srcfl#910) for a reason that applies just as
hard to its replacement: the box UI must not execute third-party JS from a
CDN, and the map must load when the gateway cannot reach the internet. So
MapLibre GL JS 6.0.0 moves into web/vendor/maplibre — the ESM entry, its
code-split chunk, its worker, the stylesheet and the license — and the
loader imports it same-origin, which also spares MapLibre its blob: worker
detour. The now-unused vendored Leaflet goes away with its test;
maplibre-vendor.test.mjs pins the new contract, including the per-request
referrerPolicy opt-in that keeps OSM volunteer tile servers from 403ing
under the box's Referrer-Policy: no-referrer.

Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant