Skip to content

fix(map): send referrer with tile requests - #4338

Merged
olemartinorg merged 1 commit into
mainfrom
fix/osm-tile-referrer
Sep 15, 2026
Merged

olemartinorg merged 1 commit into
mainfrom
fix/osm-tile-referrer

Conversation

@olemartinorg

@olemartinorg olemartinorg commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Description

OpenStreetMap tiles could be blocked when an app's page-level referrer policy removed the identifying Referer header. This sets a referrer policy on raster tile images so the browser sends the app origin to the tile provider. It also covers local HTTP apps requesting the existing HTTPS OpenStreetMap tile URL.

Related Issue(s)

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* and backport* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

Checks run

  • yarn test MapComponent.test.tsx --runInBand
  • yarn tsc
  • staged-file ESLint pre-commit hook

Summary by CodeRabbit

  • Enhancements
    • Map tiles now use a stricter referrer policy to improve privacy when loading map imagery.
  • Tests
    • Added coverage to verify the map tile referrer policy is applied correctly.

OpenStreetMap now blocks web tile requests without a valid Referer header.
Set a per-tile referrer policy so local environments still identify their
origin when loading the HTTPS tile service, even if the page-level policy is
restrictive.
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5dc15731-f048-46fd-8175-7ccbfce65f53

📥 Commits

Reviewing files that changed from the base of the PR and between 982a5fe and 857caec.

📒 Files selected for processing (2)
  • src/layout/Map/MapComponent.test.tsx
  • src/layout/Map/features/layers/MapLayers.tsx

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The map tile layer now sets referrerPolicy to strict-origin-when-cross-origin. The map tile test verifies this value and the existing empty alt attribute.

Changes

Map tile referrer policy

Layer / File(s) Summary
Set and verify tile referrer policy
src/layout/Map/features/layers/MapLayers.tsx, src/layout/Map/MapComponent.test.tsx
OurTileLayer sets the tile referrer policy. The map tile test verifies the rendered policy and empty alt attribute.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 857ca

Map tile requests now include an origin referrer under restrictive page policies, restoring default OpenStreetMap tiles for affected deployments. The focused change is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change addresses issue #4337 by configuring a per-tile referrer policy for OpenStreetMap requests and adding a unit test for the behavior.
Out of Scope Changes check ✅ Passed The changes are limited to the map tile referrer policy and its unit test. No unrelated changes are present.
Title check ✅ Passed The title clearly and concisely describes the main change: sending a referrer with map tile requests.
Description check ✅ Passed The description is complete and matches the repository template. It explains the problem, references issue #4337, records manual and automated verification, and covers the required project checks. The…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/osm-tile-referrer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@olemartinorg olemartinorg added kind/bug Something isn't working backport-ignore This PR is a new feature and should not be cherry-picked onto release branches labels Sep 10, 2026
Comment thread src/layout/Map/features/layers/MapLayers.tsx
@olemartinorg
olemartinorg merged commit c700788 into main Sep 15, 2026
12 of 16 checks passed
@olemartinorg
olemartinorg deleted the fix/osm-tile-referrer branch September 15, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-ignore This PR is a new feature and should not be cherry-picked onto release branches kind/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Map/Kart: OpenStreetMap bakgrunnskart fungerer ikke lengre

2 participants