You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that the session cookies written in the SetCookie headers are not set by default. If this field is not set, the end users of this library are vulnerable to cookie theft by potential XSS attacks. OWASP recommends HttpOnly to be set for session cookies, which is why in my opinion it would be good practice to set the cookie by default in the library code.
Of course, you can set the flag manually by calling session.Options.HttpOnly = true before session.Save(r, w), but I doubt most users remember or understand that the field should be set by them (I only discovered this after doing some digging).
If you think this sounds like something the library should do, I don't mind sending out a PR for it, should be a one-line fix.
PS: Thanks for all the work you've done on the library :)
The text was updated successfully, but these errors were encountered:
I noticed that the session cookies written in the SetCookie headers are not set by default. If this field is not set, the end users of this library are vulnerable to cookie theft by potential XSS attacks. OWASP recommends HttpOnly to be set for session cookies, which is why in my opinion it would be good practice to set the cookie by default in the library code.
Of course, you can set the flag manually by calling
session.Options.HttpOnly = true
beforesession.Save(r, w)
, but I doubt most users remember or understand that the field should be set by them (I only discovered this after doing some digging).If you think this sounds like something the library should do, I don't mind sending out a PR for it, should be a one-line fix.
PS: Thanks for all the work you've done on the library :)
The text was updated successfully, but these errors were encountered: