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

CSP header filter may not play well with others #290

Closed
GaryJones opened this issue Jun 5, 2020 · 2 comments · Fixed by #557
Closed

CSP header filter may not play well with others #290

GaryJones opened this issue Jun 5, 2020 · 2 comments · Fixed by #557
Labels

Comments

@GaryJones
Copy link
Contributor

This method is a filter on wp_headers action:

public function upgrade_insecure_requests( $headers ) {
$headers['Content-Security-Policy'] = 'upgrade-insecure-requests';
return $headers;
}

If there is already some code that filters wp_headers to add a value for Content-Security-Policy, then this value wipes that out without any consideration for what may already be there.

Could the method be a bit more subtle and check for the presence of a Content-Security-Policy, and append upgrade-insecure-requests if it doesn't already exist / amend the value if there is a value that would conflict with that?

@westonruter
Copy link
Collaborator

Yes, that's a great point.

@pooja-muchandikar
Copy link

QA Passed ✅ the changes are reflecting as expected.

Before:
Screenshot 2022-04-21 at 2 37 53 PM

--

After:

Screenshot 2022-04-21 at 2 38 08 PM

@westonruter westonruter removed this from the 0.7 milestone Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants