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

Make cookieName mandatory? #54

Closed
vvo opened this issue Apr 7, 2020 · 7 comments
Closed

Make cookieName mandatory? #54

vvo opened this issue Apr 7, 2020 · 7 comments

Comments

@vvo
Copy link
Owner

vvo commented Apr 7, 2020

When developing multiple websites on the same host (localhost:3000), then the cookieName and value can be shared between applications. While this is not a security issue (localhost), it's still annoying because it will lead to errors like "Error: Bad hmac value" because we're trying to decode appx cookie using the password of appy.

By making cookieName mandatory, we could avoid that and recommend to always use __appx __appy cookie names

@Dashue
Copy link
Contributor

Dashue commented Apr 30, 2020

I'd be for this, just now trying to figure out where cookiename goes. Just installed the package and am not looking for intellisense for typescript, to then figure out where cookie name goes :)

@vvo
Copy link
Owner Author

vvo commented Apr 30, 2020

@Dashue Do you mean that when using this package (thanks), your editor did not suggest the cookieName option? (https://github.com/vvo/next-iron-session#withironsessionhandler--password-ttl-cookiename-cookieoptions-)

I happen to be working on the package right now so I will just do that (make it mandatory)

@Dashue
Copy link
Contributor

Dashue commented Apr 30, 2020

Exactly, I'm using typescript.

Not sure if you're shipping declaration files?
Or maybe it was just Vs having a moment

@vvo
Copy link
Owner Author

vvo commented Apr 30, 2020

FWIW: I am not using typescript and I get autocomplete by default,

image

I do not ship declaration files (since I am not using TS I don't even know how to do so). But I welcome any PR adding some.

vvo added a commit that referenced this issue May 1, 2020
BREAKING CHANGE: cookieName is now mandatory, to avoid issues of shared
cookieNames in examples etc..

fixes #54
vvo added a commit that referenced this issue May 1, 2020
…uired

New features:
- an Express/Connect middleware: import { ironSession } from "next-iron-session"
  app.use(ironSession(options))
  or router.get("/", ironSession(options), (req, res, next) => {});
- import { applySession } from "next-iron-session":
  await applySession(req, res, options);

Examples:
- moved to examples/ folder
- added an Express example

BREAKING CHANGE:
- you need to import withIronSession as a named export:
before: import withIronSession from "next-iron-session"
after: import { withIronSession } from "next-iron-session"
- cookieName option is now mandatory (#54)

fixes #54
fixes #9
fixes #41
This was referenced May 1, 2020
vvo added a commit that referenced this issue May 1, 2020
…uired

New features:
- an Express/Connect middleware: import { ironSession } from "next-iron-session"
  app.use(ironSession(options))
  or router.get("/", ironSession(options), (req, res, next) => {});
- import { applySession } from "next-iron-session":
  await applySession(req, res, options);

Examples:
- moved to examples/ folder
- added an Express example

BREAKING CHANGE:
- you need to import withIronSession as a named export:
before: import withIronSession from "next-iron-session"
after: import { withIronSession } from "next-iron-session"
- cookieName option is now mandatory (#54)

fixes #54
fixes #9
fixes #41
@vvo
Copy link
Owner Author

vvo commented May 1, 2020

🎉 This issue has been resolved in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@vvo
Copy link
Owner Author

vvo commented May 1, 2020

🎉 This issue has been resolved in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@vvo vvo added the released label May 1, 2020
@eric-burel
Copy link

Hi, what am I expected to do to fix this error? Add an explicit cookie name? I have this warning when running my Cypress e2e tests in headless mode, it might be a different issue, are there scenarios where the Hmac value cannot be computed? I couldn't find much documentation about this error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants