Skip to content

Studio CSP: allow the map tiles, check outside origins at build (#559) - #564

Merged
bubulux merged 1 commit into
mainfrom
fix/559-map-csp
Dec 3, 2026
Merged

bubulux merged 1 commit into
mainfrom
fix/559-map-csp

Conversation

@bubulux

@bubulux bubulux commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Closes #559

What changed

  • apps/studio/public/_headers: img-src also allows https://tile.openstreetmap.org, with a comment saying why.
  • scripts/csp-hash.mjs --check (already run by pnpm build / make check / CI): it also fails when an app's code (its src and packages/design/src) loads from an https:// origin that its _headers CSP does not name. Links (href="https://…") and XML namespaces are skipped. Before this fix it failed with: apps/studio/src/places/map.tsx loads from https://tile.openstreetmap.org, which its _headers Content-Security-Policy does not allow. Test: scripts/csp-hash.test.mjs.
  • Docs: docs/infrastructure.md lost its stale Open-Meteo line (the rebuilt Studio calls no weather API, and it was never in connect-src). docs/development.md describes the new check.

Decisions

  • Referer: unchanged. The tile layer already sets referrerPolicy: "strict-origin-when-cross-origin" itself (places/map.tsx:22), which overrides the page's same-origin, so OSM gets the origin.
  • Admin board: shows no map, so its _headers is unchanged (the check covers it too).

Checked / not checked

  • make check green. The check failed on the old policy and passes with the fix.
  • Not checked on a deployed instance: the Vite dev server does not apply _headers. After a deploy, a map (Sets/Locations map view or the pin dialog) should show tiles.

🤖 Generated with Claude Code

…ild (#559)

img-src takes https://tile.openstreetmap.org. scripts/csp-hash.mjs --check (run by the build) now also fails when an app's code loads from an https origin its _headers does not name; links and XML namespaces are left out. The stale Open-Meteo line in docs/infrastructure.md goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bubulux
bubulux merged commit 9ca6e90 into main Dec 3, 2026
5 checks passed
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.

Studio maps are blank on deployed instances: CSP blocks the OpenStreetMap tiles

1 participant