Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rel=noreferrer to Exit this page link #3921

Closed
Tracked by #2950
gregtyler opened this issue Jul 7, 2023 · 2 comments · Fixed by #4054
Closed
Tracked by #2950

Add rel=noreferrer to Exit this page link #3921

gregtyler opened this issue Jul 7, 2023 · 2 comments · Fixed by #4054
Assignees
Labels
exit this page feature request User requests a new feature
Milestone

Comments

@gregtyler
Copy link

Related component

Exit this page

Context

When exiting the service, the target website by default has knowledge of the referring page within the service. The target website therefore could show a message like "Thank you for visiting us from X", which would undermine the intention of the exit route and potentially put the user at risk.

This can be somewhat mitigated by choosing sensible exit sites, but since we have no control over external website's content their behaviour cannot be guaranteed.

By adding the rel="noreferrer" attribute to the link, the target website will not be passed the referrer's information by the browser and it will instead behave as if the user has visited the target website directly.

Alternatives

There is also rel="noopener", which prevents setting the window.opener property on the target site. rel=noreferrer provides this functionality and strips out the "Referer" header.

Additional information (if applicable)

  • Original slack thread
  • NB: the Referer is knowingly misspelt in the HTML spec and all implementations
  • The attribute has wide support. Where unsupported, it is just ignored and acts as if not provided.
@gregtyler gregtyler added awaiting triage Needs triaging by team feature request User requests a new feature labels Jul 7, 2023
@owenatgov owenatgov removed the awaiting triage Needs triaging by team label Jul 7, 2023
@owenatgov
Copy link
Contributor

Thanks a lot for raising this @gregtyler. Seems sensible and low effort.

It's also outlined that we forgot to add an attributes param to the nunjucks macro which could've been a stop gap in our guidance. This should be a default attribute for the component but I think we can also add support for passing custom attributes to the component as part of this.

@querkmachine
Copy link
Member

As an additional thought, should we include the nofollow value as well? This would indicate to search engines that the link is not endorsed by GOV.UK for the purposes of determining search rankings.

Probably a minor thing but as we're linking off to external services, we may want to make that relationship clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exit this page feature request User requests a new feature
Projects
Development

Successfully merging a pull request may close this issue.

4 participants