Skip to content

Improvements in treemap node URL handling, AS-706 - #103

Merged
snake14 merged 3 commits into
6.x-devfrom
as706-6x
Sep 3, 2026
Merged

snake14 merged 3 commits into
6.x-devfrom
as706-6x

Conversation

@snake14

@snake14 snake14 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Forward-ports #102 to 6.x-dev, so a treemap only opens node URLs that are safe to open.

A row's url metadata comes from tracked data and can use any scheme, and the treemap opens it when a node is clicked. It is now filtered through UrlHelper::isLookLikeSafeUrl() before it becomes part of the treemap data, a URL without a scheme is prefixed with http:// so it is not resolved against the Matomo URL, the browser checks it again with window.vueSanitizeUrl(), and the new window no longer gets access to the opener document.

Two deliberate differences from the 5.x change:

  • 5.x calls window.vueSanitizeUrl only where it exists, because the plugin supports Matomo 5.0 and the helper arrived in 5.11. Every Matomo this branch supports ships it, so the guard is dropped.
  • A blank url metadata passed the safety check and picked up the http:// prefix, which put a link icon on rows such as "Page URL not defined" — that is what moved the screenshot on 5.x. The second commit drops blank URLs instead, so those rows render as they did before and the 6.x baseline is left as it is. The same fix is still owed on 5.x-dev.

Released as 6.0.1, since 6.0.0 is already out.

Verified locally: PHPCS and PHPStan clean on the changed files, and the plugin's unit tests pass (9/9).

Issue No

AS-706 — forward-port of #102.

Steps to Replicate the Issue

See #102; the behaviour and the tests are the same on this branch.

Checklist

  • [✔] Tested locally or on demo2/demo3?
  • [✔] New test case added/updated?
  • [NA] Are all newly added texts included via translation?
  • [NA] Are text sanitized properly? (Eg use of v-text v/s v-html for vue)
  • [✔] Version bumped?
  • [✔] I have understood, reviewed, and tested all AI outputs before use
  • [✔] All AI instructions respect security, IP, and privacy rules
  • [NA] Documentation updated?

AltamashShaikh and others added 3 commits September 3, 2026 16:07
The URL metadata of a report row is based on tracked data and can use any scheme,
so it is filtered through UrlHelper::isLookLikeSafeUrl() before it becomes part of
the treemap data, checked again in the browser, and opened without giving the new
window access to the opener document.

The 5.x guard around window.vueSanitizeUrl is dropped here, since every Matomo this
branch supports ships the helper.

(cherry picked from commit a2eddfb)
A blank url metadata passes isLookLikeSafeUrl() and picks up the http:// prefix, so a
row such as "Page URL not defined" gains a link icon that opens the bare scheme.
The same fix is still owed on 5.x-dev.
@snake14
snake14 requested a review from a team September 3, 2026 05:24
@snake14
snake14 merged commit 9b1ede7 into 6.x-dev Sep 3, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants