I would like to use the Content Security Policy for my JSF 2.1-based web projects as I think this can significantly improve protection against XSS attacks.
Due to the default CSP behavior to block all embedded JavaScript , it basically breaks JSF
<f:ajax execute="input" render="output" />
functionality. This is because JSF generates a lot of inline JavaScript code using the above construction.
Does anyone know if there is a way to use CSP in JSF-based projects that use f: ajax without having to enable embedded JS using the following CSP directive:
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'
I know that manually placing all JavaScript in a separate file would be possible, but in doing so I would have to manually use all the Ajax materials.
source
share