Understanding the intended behaviour of HTTPOnly flag
Asked Answered
S

1

2

I have a slight confusion regarding HTTPOnly attribute in cookies. I am aware that its main use is for protection against XSS attacks. Let us assume there is web application which has set httponly enabled for the cookie. I used a interception proxy like Fiddler for this. But in all subsequent transactions the cookie is not accompanied with the httponly flag. is this a feature like set it once and the whole session is covered under httponly flag...or is this a implementation flaw. But again when monitored through a cookie manager addon,the properties show that httponly is enabled. My question is if its enabled why the cookie manager shows it enabled but not an interception proxy,is this the normal expected behaviour or a wrong implementation. Please help me understand.

Spessartite answered 22/5, 2012 at 8:24 Comment(0)
C
4

HttpOnly is sent by the server in the Set-Cookie header to instruct the browser not to make the cookie available to javascript. The browser will still send it over http connections. The Set-Cookie header can contain all sorts of instructions for cookies, like when they expire, what domain they are for, whic path, whether they should only be sent over https(Secure flag) and HttpOnly. These are all instructions from the server to the browser, so there is no point in the browser sending them back to the server on each request.

Crossing answered 23/5, 2012 at 5:23 Comment(1)
So, @Crossing , HttpOnly is set only once by the server and it applies for the cookie throughout the session i.e if i monitor the web application trafic through a interception proxy like Fiddler I will see the httponly flag only once,when its set by the server and not in any furthur subsequent request and responses,am I understanding correct.Spessartite

© 2022 - 2024 — McMap. All rights reserved.