Repository navigation
Conversation
The footer's Get Support link opened FLEXMEASURES_SUPPORT_PAGE with rel="noopener noreferrer", also when that page is on the same site, such as a plugin's support form. Such a page now gets the referrer (rel="noopener"), so it can tell which page the user came from; an external support page still gets none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: F.N. Claessen <claessen@seita.nl>
|
📖 3 files modified Preview · build overview · flexmeasures · built Dec. 2, 2026, 4:25 p.m. UTC |
…gets no referrer Browsers drop tabs and newlines from a URL, so FLEXMEASURES_SUPPORT_PAGE = "/\t/host" leads to //host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: F.N. Claessen <claessen@seita.nl>
Flix6x
left a comment
There was a problem hiding this comment.
Self-review from a demo that rendered the footer's support block from main and from this branch for eight values of FLEXMEASURES_SUPPORT_PAGE, put it on an asset page with the default Referrer-Policy: strict-origin-when-cross-origin, and clicked it in headless Chromium.
It works as described: a path on this site (/support, also with a query) now receives the full URL of the asset page, where main sent nothing. An external URL, //host and /\host still get no referrer, and so do the conservative cases (a full URL on this very host, a path without the leading /), which matches the configuration docs. The new test fails on main's template and passes here; the other UI tests and CI pass.
One gap, now fixed on this branch: /, a tab, then /host passed the check (its second character is a tab), but browsers drop tabs and newlines from a URL, so the link went to //host, which received this site's origin. Only the host's own config sets this value, so it was hardening rather than a hole. The pushed commit also excludes a tab, newline or carriage return as the second character, with two more test cases. I'll merge once CI is green on the new head.
|
Follow-ups of the review:
|
Description
FLEXMEASURES_SUPPORT_PAGEwithrel="noopener"when that is a path on the same site (it starts with/, and not with//or/\, which browsers treat as another host), so the support page receives the referrer: the page the user came from.rel="noopener noreferrer", and the Sign up and Terms of Service links are left as they are.documentation/changelog.rst(Infrastructure / Support), and a line in the configuration docs.Why: a plugin's support form, such as the one in Seita's EMS, can then prefill the asset the user was looking at from the referrer, without remembering every page the user visits in their session. (
Referrer-Policystaysstrict-origin-when-cross-origin, so the full URL is only sent to the same origin.)How to test
pytest flexmeasures/ui/tests/test_footer.py: renders the footer with a relative support page (rel="noopener"), and with an absolute, a protocol-relative and a/\one (allrel="noopener noreferrer"). The relative case fails without the template change.Related Items
A follow-up of the review of SeitaBV/ems#314 (its support form remembers the asset page in the session, as no referrer reaches it now).
Sign-off
🤖 Generated with Claude Code