阅读记录——利用httponly提高cookie安全性

一般的Cookie都是从document对象中获得的,我们只要让敏感的Cookies,对浏览器document不可见就行了。设置Cookie的时候设置HttpOnly的参数,浏览器的document对象中就看不到Cookie了,而浏览器在浏览的时候不受任何影响,因为Cookie会被放在浏览器头中发送出去(包括ajax的时候),应用程序也一般不会在js里操作这些敏感Cookie的,对于一些敏感的Cookie我们采用HttpOnly,对于一些需要在应用程序中用js操作的cookie我们就不予设置,这样就保障了Cookie信息的安全也保证了应用

This attribute specifies that a cookie is not accessible through script. By using HTTP-only cookies, a Web site eliminates the possibility that sensitive information contained in the cookie can be sent to a hacker's computer or Web site with script.

Mitigating Cross-site Scripting With HTTP-only Cookies

你可能感兴趣的:(阅读记录——利用httponly提高cookie安全性)