Skip to content

update readme with information/warning about cookie length#115

Merged
jaw187 merged 2 commits intohapijs:masterfrom
geuis:patch-1
Feb 26, 2016
Merged

update readme with information/warning about cookie length#115
jaw187 merged 2 commits intohapijs:masterfrom
geuis:patch-1

Conversation

@geuis
Copy link
Copy Markdown
Contributor

@geuis geuis commented Feb 21, 2016

Updated README opening.

  • Added information about cookie lengths and if they are too long, they don't get set.
  • Adjusted formatting of text in the opening paragraph to be a little easier to read.

I got bit by this today when I spent an hour wondering why my session cookies weren't being set. When I last opened my project, bell + hapi-auth-cookie was signing into Twitter with no problem. But today it was mysteriously failing at first. It finally clicked that the cookie length was way too long. The credential data Twitter was returning a few days ago was a smaller size than today (I may made some last minute change and forgot about it), and that's why it was failing.

Since it wasn't documented in the README already, I figure its just a nice thing to remind people about in case they run into a similar problem in the future.

Updated README opening.

- Added information about cookie lengths and if they are too long, they don't get set. 
- Adjusted formatting of text in the opening paragraph to be a little easier to read.

I got bit by this today when I spent an hour wondering why my session cookies weren't being set. When I last opened my project, bell + hapi-auth-cookie was signing into Twitter with no problem. But today it was mysteriously failing at first. It finally clicked that the cookie length was way too long. The credential data Twitter was returning a few days ago was a smaller size than today (I may made some last minute change and forgot about it), and that's why it was failing.

Since it wasn't documented in the README already, I figure its just a nice thing to remind people about in case they run into a similar problem in the future.
README.md Outdated
It is important to remember a couple of things:

1. Cookies have a practical maximum length. All of the data you store in a cookie is sent to the browser. If your cookie is too long, browsers may not set it. Read more [here](http://webdesign.about.com/od/cookies/f/web-cookies-size-limit.htm) and [here](http://www.ietf.org/rfc/rfc2965.txt). If you need need to store more data, store a small amount of identifying data in the cookie and use that as a key to a server-side cache system.
2. Each cookie operates as a bearer token and anyone in possession of the cookie content can use it to impersonate its true owner.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this first in the list.

jaw187 added a commit that referenced this pull request Feb 26, 2016
update readme with information/warning about cookie length
@jaw187 jaw187 merged commit 7718749 into hapijs:master Feb 26, 2016
@nlf nlf added the documentation Non-code related changes label Mar 28, 2017
@nlf nlf added this to the 7.0.0 milestone Mar 28, 2017
@lock
Copy link
Copy Markdown

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot unassigned jaw187 Jan 9, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

documentation Non-code related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants