Content Security Policy issue
I have recently been asked to ensure our site scan is A+.. currently we are at an A because of the Content-Security-Policy header.
Currently the value is:
default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline' *.google-analytics.com *.googleapis.com *.mysite.com;
The warning from the scan is that the words 'unsafe-eval' and 'unsafe-inline' are dangerous. The issue is that whenever I remove those from the policy, I get the following error:
refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' *..... etc.
All of my CS and JS are in their proper files and there is NO inline JS or CSS on my page. It appears that coldfusion is adding script as shown below.. right above my </head> tag.. and that is what is causing the error to occur. If I change my <cfform tag to just <form the error goes away. Any ideas how I can fix this?
<script type="text/javascript">
<!--
_CF_checklogin = function(_CF_this)
{
//reset on submit
_CF_error_exists = false;
_CF_error_messages = new Array();
_CF_error_fields = new Object();
_CF_FirstErrorField = null;
//display error messages and return success
if( _CF_error_exists )
{
if( _CF_error_messages.length > 0 )
{
// show alert() message
_CF_onErrorAlert(_CF_error_messages);
// set focus to first form error, if the field supports js focus().
if( _CF_this[_CF_FirstErrorField].type == "text" )
{ _CF_this[_CF_FirstErrorField].focus(); }
}
return false;
}else {
return true;
}
}
//-->
</script>
</head>
