Skip to content

Keep the referrer on a same-site Get Support link - #2949

Open
Flix6x wants to merge 2 commits into
mainfrom
fix/same-site-support-link-referrer
Open

Flix6x wants to merge 2 commits into
mainfrom
fix/same-site-support-link-referrer

Conversation

@Flix6x

@Flix6x Flix6x commented Dec 2, 2026

Copy link
Copy Markdown
Member

Description

  • The footer's Get Support link opens FLEXMEASURES_SUPPORT_PAGE with rel="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.
  • An external support page (a full URL) keeps rel="noopener noreferrer", and the Sign up and Terms of Service links are left as they are.
  • Added changelog item in 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-Policy stays strict-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 (all rel="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

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on code under GPL or other license that is incompatible with FlexMeasures

🤖 Generated with Claude Code

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>
@Flix6x Flix6x added this to the 1.2.0 milestone Dec 2, 2026
@Flix6x Flix6x self-assigned this Dec 2, 2026
@read-the-docs-community

read-the-docs-community Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

📖 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 Flix6x left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

@Flix6x

Flix6x commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

Follow-ups of the review:

  • push-fix (exclude "//host" from the same-site support link): pushed ca0cb9b to this branch (two more cases in test_footer.py, which fail without the change).
  • merge once CI is green: not merged. CI is green on ca0cb9b, but the PR has no approving review yet (review required), so it can't be merged. Left: an approval from a reviewer, then a squash merge.

This branch has not been deployed

No deployments
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.

1 participant