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

Always send a referrer-policy header #15673

Merged
merged 1 commit into from Mar 11, 2020
Merged

Conversation

polarbirke
Copy link
Contributor

Suggested fix / improvement for #14764

@@ -287,6 +287,9 @@ public function render()
// don't send Referer-Header for outgoing links
if (!empty($this->useStrictReferrerPolicy)) {
Common::sendHeader('Referrer-Policy: same-origin');
} else {
// always send explicit default header
Common::sendHeader('Referrer-Policy: no-referrer-when-downgrade');
Copy link
Member

Choose a reason for hiding this comment

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

@Findus23 do you have maybe some thoughts on this?

Copy link
Member

Choose a reason for hiding this comment

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

no-referrer-when-downgrade is the default when no header is sent, so sending it when we normally wouldn't send anything shouldn't change anything.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy

Copy link
Member

Choose a reason for hiding this comment

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

thanks @Findus23 be good if someone could still test the PR and have a look at tests. Not sure if I find time today.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aye it's the (implicit) default; this PR caters to our setup where we set a strict policy if nothing is explicitly set by the application (see this comment). Just in case you want to cater for our way of thinking (not sure if we're the outlier here or if more people might want to set their policies with setifempty).

@tsteur tsteur added this to the 3.13.4 milestone Mar 5, 2020
@tsteur tsteur added the Needs Review PRs that need a code review label Mar 5, 2020
@diosmosis
Copy link
Member

Tests look fine and matomo seems to work fine locally for me, will merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants