dynamic inline script, hashes, and CSP unsafe-inline
-
Wordfence writes an inline event handler javascript in the header of the page. The script ends with:
(‘//mysite.com/?wordfence_lh=1&hid=A49E4F44F688F7A6996859429437F777’);
where the value of hid is generated dynamically, changing every time the page is displayed.
I am attempting to implement a Content Security Policy for my site in which it is not necessary to use the “unsafe-inline” directive. But to do this, I must either include hashes of all inline scripts or a nonce. I see no way to use nonces, but it is impossible to use hashes, too, if the script itself changes dynamically.
So, my question is whether it is really necessary to include that dynamic hid in the script? Or, can you suggest a way to avoid the potential security issue of using “unsafe-inline”? As far as I can see, the only real solution (assuming I want to continue to use Wordfence) is to change the code in the plugin to do want you want to do without dynamic, inline scripts.
- The topic ‘dynamic inline script, hashes, and CSP unsafe-inline’ is closed to new replies.