-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Improve Default Content Security Policy (CSP) to make default JHipster applications more secure #21067
Comments
I believe Can you please test your suggested changes with an Angular, React, and a Vue app and see if they work? |
Angular did work apart from some console errors regarding the mentioned points. I'll test React/Vue in the next days. |
Nice. When we added the csp angular didn't work at all without unsafe inline. |
This issue is stale because it has been open for too long without any activity. |
Not stale |
This issue is stale because it has been open for too long without any activity. |
still not stale. Will sooner or later pick it up ;-) |
This issue is stale because it has been open for too long without any activity. |
Overview of the feature request
At the moment, the default CSP (at least we have one) looks like this:
generator-jhipster/generators/server/templates/src/main/resources/config/application.yml.ejs
Lines 373 to 377 in 7dd8197
We do have
unsafe-inline
andunsafe-eval
inscript-src
andstyle-src
. This is not optimal from security perspective, because injected javascript code would theoretically be executed. By default, we should produce the application in a way, that it works without these unsafe rules and then also get rid of these defaults.In some place, we do have (unnecessary) inline javascript code like
href="javascript:void(0)"
which can be quite easily be replaced, in others, we do have script tags in the initial html, which probably requires a nonce - or should be extracted into an actual script file. Then, we also have some dependencies, like springdoc / swagger ui, which do have open issues about this for quite some time.Motivation for or Use Case
Make the default jhipster configuration be more secure.
Related issues or PR
#9549, swagger-api/swagger-ui#7540, springdoc/springdoc-openapi#1492
The text was updated successfully, but these errors were encountered: