My JavaScript code:
function CookieSetting(name, value) {
var today = new Date();
today.setTime( today.getTime() );
var expires = 28;
expires = expires * 1000 * 60 * 60 * 24;
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name+"="+escape( value ) +
( ( expires ) ?";
domain="+window.location.hostname+";path=/;expires="+expires_date.toGMTString() : "" )
}
It's working fine, but when I run the Fortify tool, it is showing this error:
The method CookieSetting() includes unvalidated data in an HTTP response header.
This enables attacks such as cache-poisoning cross-site scripting cross-user defacement page hijacking cookie manipulation or open redirect.
Including unvalidated data in an HTTP response header can enable cache-poisoning cross-site scripting, cross-user defacement, page hijacking, cookie manipulation or open redirect.
How can I fix this?