Skip to content

Simplify Content-Security-Policy Configuration #13241

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

Open
3 tasks
jzheaux opened this issue May 26, 2023 · 0 comments
Open
3 tasks

Simplify Content-Security-Policy Configuration #13241

jzheaux opened this issue May 26, 2023 · 0 comments
Labels
in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement

Comments

@jzheaux
Copy link
Contributor

jzheaux commented May 26, 2023

With the removal of X-XSS-Protection, it would be nice to simplify adding Content-Security-Policy.

One way to do this is to turn on Content-Security-Policy-Report-Only by default. Spring Security could provide a simple reporting endpoint that publishes an ApplicationEvent when the policy is violated. Similar to DefaultLoginPageGeneratingFilter, this endpoint would likely be replaced, but would work for giving applications a head start on Content-Security-Policy.

Folks would change this behavior by setting the header themselves like so:

http.headers((headers) -> headers.contentSecurityPolicy())

The above would replace Content-Security-Policy-Report-Only: default-src 'self'; report-uri: /report-uri with Content-Security-Policy: default-src 'self'.

  • Provide default endpoint for reporting violations
  • Change default directive for report-only to report to default endpoint
  • Make report-only setting the default
@jzheaux jzheaux added status: waiting-for-triage An issue we've not yet triaged type: enhancement A general enhancement labels May 26, 2023
@jzheaux jzheaux added in: web An issue in web modules (web, webmvc) and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant