how do I test httpOnly cookie flag
Asked Answered
E

5

22

I have set the following property in websphere for the jsession cookie com.ibm.ws.webcontainer.HTTPOnlyCookies.

Any idea how best to test this using JavaScript in Firefox or IE?

Episternum answered 30/11, 2010 at 17:22 Comment(0)
C
13

It's a pain in IE. I have IE9 so your screens may be different.

Press F12, go to the network tab, and then press Start Capturing. Back in IE then open the page you want to view. Back in the F12 window you show see all the individual HTTP requests, select the one that's the page or asset you're checking the cookies on and double click on it. You should then be able to see all the response headers and cookies on their relevant tabs.


Edit:

A HttpOnly Cookie would look something like this:

Set-Cookie: SessionId=z5ymkk45aworjo2l31tlhqqv; path=/; HttpOnly

The cookie may not be sent with every response, so you may need to clear all of your cookies and then try again to make sure one is sent with the request you're monitoring.

Consistory answered 21/8, 2012 at 21:52 Comment(1)
It isn't showing the httponly nor the secure flag set on site, which has HTTPS enabled...Cocainize
S
8

Firebug - click on the Cookies tab

Sterne answered 16/11, 2012 at 16:9 Comment(0)
E
3

firecookie for firefox gives me the answer.

Episternum answered 1/12, 2010 at 15:22 Comment(0)
B
1

The easiest way to do it on Chrome or Firefox is as below:

  • Open the page for instance somedomain.com
  • Open dev tools by right clicking on page and then clicking on Inspect or Inspect Element
  • Click on Network tab
  • Click on any of the actual request and go to Headers section
  • Now look for set-cookie in response headers

Here is the screenshot for details enter image description here

Benford answered 25/8, 2022 at 13:14 Comment(0)
A
-4

add the following lines to your app String

sessionid = request.getSession().getId();
response.setHeader("SET-COOKIE", "JSESSIONID=" + sessionid + "; secure; HttpOnly");
Apterous answered 6/10, 2014 at 17:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.