Skip to content

fix(security): maplibre-gl 5 -> 6, clearing the last shipped critical - #26

Merged
hemv-857 merged 1 commit into
mainfrom
fix/maplibre-6-xss
Oct 12, 2026
Merged

hemv-857 merged 1 commit into
mainfrom
fix/maplibre-6-xss

Conversation

@hemv-857

Copy link
Copy Markdown
Owner

Clears the last shipped-runtime critical on this repo.

The vulnerability

maplibre-gl@5.24.0 — XSS sanitizer bypass in DOM.sanitize() via Live NamedN... Vulnerable range requires 6.14.0; there is no patch in 5.x.

The change

maplibre-gl v6 removed the default export. Two files imported it as maplibregl and are now on named imports:

  • src/components/MapContainer.ts — Map is imported as MapLibreMap, because this module also uses the built-in Map (routeGroups = new Map<string, ...>) and a bare Map import shadows it. NavigationControl, Popup, ScaleControl, GeoJSONSource take their plain names.
  • src/config/basemap-styles.ts — addProtocol

No call-site behaviour changed; only the import form.

Verification

Gate Result
npm run typecheck pass
npm run lint pass
npm run build built (same CSS warning as before)
npm audit critical 1 → 0, total 34 → 33

On the test suite

test:data reports 401 failures — the same 401 main reports. Both numbers are worth being precise about, because the naive reading is misleading:

tests pass fail
main, no build 10109 9710 393
main, after npm run build 10121 9714 401
this branch, after npm run build 10121 9714 401

8 chunking/bundle-boundary assertions read build output from dist/, so they only run meaningfully against a fresh build. Comparing like-for-like, this branch's failing set is identical to main's — set difference in both directions is empty. The migration introduces no regressions.

The 401 are pre-existing and unrelated; #23 has context. They should drop when the suite is burned down.

One thing I did not fix

tests/map-renderer-deferral.test.mjs asserts MapContainer.ts must not statically import maplibre-gl — the renderer is meant to load lazily via dynamic import. That invariant is already violated on main, which is why it is among the 401. Fixing it properly means moving the maplibre import into the deferred renderer, which is a refactor rather than a dependency bump, and it is not what this PR should be doing.

XSS sanitizer bypass in DOM.sanitize() via Live NamedN... No patch exists in
5.x; the advisory requires 6.14.0.

v6 removed the default export. MapContainer imports Map as MapLibreMap because
the module also uses the built-in Map, and a bare Map import would shadow it.
basemap-styles takes addProtocol directly.

Call-site behaviour is unchanged; only the import form.

typecheck pass, lint pass, build pass, npm audit critical 1 -> 0.

test:data: 401 failures, identical set to main after building both (verified with a
worktree at origin/main; set difference empty in both directions).
Copilot AI balanced review requested due to automatic review settings October 12, 2026 19:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@hemv-857
hemv-857 merged commit ebf7428 into main Oct 12, 2026
1 check passed
@hemv-857
hemv-857 deleted the fix/maplibre-6-xss branch October 12, 2026 19:17
@vercel

vercel Bot commented Oct 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
orion-eight-render Ready Ready Preview Oct 12, 2026 7:39pm UTC

This branch was successfully deployed

1 active deployment
Preview — 728f8441 Deployed Oct 12, 2026 by vercel[bot]
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.

2 participants