Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encrypt cookies #9

Closed
defunctzombie opened this issue May 7, 2014 · 18 comments
Closed

encrypt cookies #9

defunctzombie opened this issue May 7, 2014 · 18 comments

Comments

@defunctzombie
Copy link

Signing is nice, but a better thing might be to just encrypt the cookies outright. This serves the purpose of signing and also hiding the session details from user inspection.

@jonathanong
Copy link
Member

Meh I don't think it's really necessary. Makes it a little harder to debug. and at that point you might as well use a session store if you want to hide details from the user

@defunctzombie
Copy link
Author

Another module I will make then ;) security requirements are different for
different apps.
On May 6, 2014 11:39 PM, "Jonathan Ong" notifications@github.com wrote:

Meh I don't think it's really necessary. Makes it a little harder to
debug. and at that point you might as well use a session store if you want
to hide details from the user


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-42394243
.

@Fishrock123
Copy link
Contributor

Can this be done via an option?

@jonathanong
Copy link
Member

i asked @jed if he wants to move his stuff here. i'm not sure if i do this in this repo, but in koa's session, i began base64 encoding the entire session anyways to avoid issues with cookies with ;s and stuff. i think base64 encoding cookies or encrypting them are good options for a cookies lib.

@Fishrock123
Copy link
Contributor

Re @defunctzombie: I would rather not have 2 libs for virtually the same thing.

@defunctzombie
Copy link
Author

I agree. I would prefer to stop using my older yummy module in favor of
this one. Maybe I will make a PR with encryption so we have something more
tangible to work with.
On May 7, 2014 11:53 AM, "Jeremiah Senkpiel" notifications@github.com
wrote:

Re @defunctzombie https://github.com/defunctzombie: I would rather not
have 2 libs for virtually the same thing.


Reply to this email directly or view it on GitHubhttps://github.com//issues/9#issuecomment-42467835
.

@nburoojy
Copy link

nburoojy commented Sep 2, 2014

FYI, I kind of hacked encryption onto this package. Let me know if you want me to clean up, test and merge my fork: https://github.com/civitaslearning/cookie-session.

@coen-hyde
Copy link

@nburoojy Can your encryption implementation be merged back into cookie-session?

@gabeio
Copy link
Member

gabeio commented Apr 10, 2015

@coen-hyde he said it was a fork so it should be possible...

@sankethkatta
Copy link

Mozilla has a package which does just this: mozilla/node-client-sessions

@dougwilson
Copy link
Contributor

Hi @sankethkatta , yep, and it's a 100% valid alternative! npm gives you a lot of choice :)

@ebourmalo
Copy link

I was also looking for this option and didn't find anything. I made a super-easy to use express middleware to achieve transparently cookie encryption / decryption: cookie-encrypter.

var app = express();
app.use(cookieParser(secretKey));
app.use(cookieEncrypter(secretKey));

Hope this helps

@btxtiger
Copy link

@ebourmalo did you get it working with cookie-session? It seems the session cookies were not caught by the middleware.

@dougwilson
Copy link
Contributor

So apparently having stale issues is a sign of bad modules these days, who knew. This is still a desired feature that I plan to work on at some point, though anyone is welcome to make a PR as well. I'm going to close this issue, unfortunately, as just having it open down ranks the module.

@sawyerh
Copy link

sawyerh commented Oct 19, 2019

@dougwilson Just confirming I'm not overlooking something: encryption support hasn't been added to cookie-session? Could this request be reopened if so?

@dougwilson
Copy link
Contributor

It has not been added and as noted above I'm not going to reopen the issue, either, for those reasons. If you want to see it happen, the best thing to do is to put to together a pull request instead of us keeping an issue open indefinitely. Perhaps if someone committed to having a pull request made in a specific timeline I can open this issue. If you want to make that commitment, let me know and I can reopen.

@btxtiger
Copy link

@dougwilson
You can check out my node module, if it fits to your requirements.
https://github.com/btxtiger/encrypt-cookie

mircohacker pushed a commit to mircohacker/cookie-session that referenced this issue Jul 29, 2020
* use nodes crypto library
* encrypt the session after serialisation
* test the correct implementation
* closes expressjs#9
@mircohacker
Copy link

@dougwilson my PR for this feature is ready. Please have a look.

mircohacker added a commit to mircohacker/cookie-session that referenced this issue Jul 29, 2020
* use nodes crypto library
* encrypt the session after serialisation
* initialisation vectors are prepended to the encrypted session
* encryption key rotation is implemented
* add the current node version to ci configuration
* test the correct implementation
* closes expressjs#9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.