9
I was reading an article and I found curious a sentence of this, where the author makes a list (right in the first paragraphs of the article) of the main safety care that we developers should take into account.
The phrase in question is:
Create secure cookies that only work via HTTPS and are not accessed by Javascript;
My question arises in this part, what are cookies that "are not accessed by javascript"?
In my own experience I have never had any problem with client-side operations involving cookies because of this or similar reason.
Obviously speaking in http context + browser (http + browser).
Since these cookies are in our browser what prevents us from obtaining them? Is there a cookie/session that is not currently on document.cookie
? Or even simply seeing the requisition headers (always have to be present here right?)?
I also hypothesize that the author made a mistake and didn’t want to say this well.
Good question, I do not remember seeing this type of cookie while programming WEB
– PauloHDSousa
I confess that I am inclined to have been a mistake on the part of the author @Paulohdsousa, but I would like to be sure
– Miguel
I had even responded and after I sent I stopped to read again. I figured you were talking about httpOnly.
– Aline
Hello @Aline I got to read your answer, but I was in the car and I couldn’t say anything until now. I edited the question, but basically there is some kind of cookie/session that is not in Document.cookie? If yes, you can add to your answer a way of doing it sff?
– Miguel
If it is in PHP, you have an option in php.ini:
session.cookie_secure = 0
which may be amended tosession.cookie_secure = 1
. But you can only create a session under https.– Maurivan
The question is not about the Heal @Maurivan parameter, but about
httponly
(who had no idea), never happened to have to get these cookies in javascript– Miguel
Well, then I’ll just reverse the exclusion. aheuha =)
– Aline