You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
If using a CSP header with RAP it would need to be configured with a CSP script-src directive with self, unsafe-inline, unsafe-eval.
Such a configurtion is very permissive and removes most of the security provided by CSP.
csp-evaluator.withgoogle.com allows to evaluate how a CSP configuration improves XSS protection and currently rates scripts-src values as follows:
unsafe-inline as High severity: unsafe-inline allows the execution of unsafe in-page scripts and event handlers.
self as Possible medium severity finding: self can be problematic if you host JSONP, Angular or user uploaded files.
unsafe-eval as Possible medium severity finding: unsafe-eval allows the execution of code injected into DOM APIs such as eval().
Ideally the script-src tag should not be configured with any of unsafe-inline, self, or unsafe-eval.
unsafe-inline is required because org.eclipse.rap.rwt.internal.service.StartupPage generates a script element with inline code.
self is required because org.eclipse.rap.rwt.internal.service.StartupPage generates a script element with a src from server.
unsafe-eval is required because RAP uses the eval() function for several features (Browser widget, client scripting and JavaScriptExecutor, BrowserFunction).
The proposed enhancement is to support configuring RWTServlet to generate a "strict" CSP header:
When CSP generation is enabled RWTServlet.sendStartupContent would:
generate a nonce on request
add a CSP header to the response: Content-Security-Policy: default-src 'self'; script-src nonce-<generatedvalue> 'unsafe-eval'; style-src 'self' 'unsafe-inline'
pass the generated nonce to the StartupPage so that it can append the nonce to the <script> elements.
Additionally:
RWTServlet could be configured to remove unsafe-eval from the src-script.
In such a situation RAP features relying on JavaScript eval() would become unusable.
RWTServlet could be configured to add other CSP directives like frame-ancestors
The text was updated successfully, but these errors were encountered:
Added the ability to set a Content Security Policy (string with directives) to the RAP application. The implementation is based on the script nonce attribute, whereby only allowed scripts are executed.
For a workbench application, the CSP can be set in a new csp attribute of the entrypoint extension in plugin.xml. In other cases, use the new org.eclipse.rap.rwt.client.WebClient.CSP property when defining an entrypoint in the ApplicationConfiguration.
Copy of Bugzilla bug 579074
If using a CSP header with RAP it would need to be configured with a CSP
script-srcdirective withself,unsafe-inline,unsafe-eval.Such a configurtion is very permissive and removes most of the security provided by CSP.
csp-evaluator.withgoogle.com allows to evaluate how a CSP configuration improves XSS protection and currently rates
scripts-srcvalues as follows:unsafe-inlineas High severity:unsafe-inlineallows the execution of unsafe in-page scripts and event handlers.selfas Possible medium severity finding:selfcan be problematic if you host JSONP, Angular or user uploaded files.unsafe-evalas Possible medium severity finding:unsafe-evalallows the execution of code injected into DOM APIs such aseval().Ideally the script-src tag should not be configured with any of
unsafe-inline,self, orunsafe-eval.unsafe-inlineis required becauseorg.eclipse.rap.rwt.internal.service.StartupPagegenerates a script element with inline code.selfis required becauseorg.eclipse.rap.rwt.internal.service.StartupPagegenerates a script element with a src from server.unsafe-evalis required because RAP uses theeval()function for several features (Browser widget, client scripting and JavaScriptExecutor, BrowserFunction).The proposed enhancement is to support configuring
RWTServletto generate a "strict" CSP header:When CSP generation is enabled RWTServlet.sendStartupContent would:
Content-Security-Policy: default-src 'self'; script-src nonce-<generatedvalue> 'unsafe-eval'; style-src 'self' 'unsafe-inline'StartupPageso that it can append the nonce to the<script>elements.Additionally:
RWTServletcould be configured to removeunsafe-evalfrom thesrc-script.In such a situation RAP features relying on JavaScript
eval()would become unusable.RWTServletcould be configured to add other CSP directives like frame-ancestorsThe text was updated successfully, but these errors were encountered: