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

Passport v0.6.0(latest) incompatibility with cookie-session #2

Open
jtouris opened this issue Oct 27, 2022 · 1 comment
Open

Passport v0.6.0(latest) incompatibility with cookie-session #2

jtouris opened this issue Oct 27, 2022 · 1 comment

Comments

@jtouris
Copy link

jtouris commented Oct 27, 2022

Issue Overview

Hi, I would like to know what suggestions/workaround you recommend to the current problem related to passport v0.6.0 incompatibility with cookie-session v2.0.0. Application throws error TypeError: req.session.regenerate is not a function so this is currently a big limitation.
The workaround provided on passport's repo is to downgrade to 0.5.x but this approach is vulnerable to CVE-2022-25896

Describe your environment

  • Editor: VSCode
  • Browser: Google Chrome
  • Running on: MacBook Pro 2.6 GHz 6-Core Intel Core i7

Steps to Reproduce

  1. install npm dependencies npm install
  2. configure database connection
  3. run project and try to login

Expected Behavior

  • User is able to Log in with proper credentials
  • User gets error message of invalid credentials (if user is not yet created or has invalid credentials)

Current Behavior

app crashes with: TypeError: req.session.regenerate is not a function

Possible Solution

downgrade passport version to 0.5.x but this approach is vulnerable to CVE-2022-25896

Screenshots / Video

Screen Shot 2022-10-27 at 8 21 03 PM

Related Issues

@joeyguerra
Copy link

I just ran into this issue. I did the following as a work around. NOTE: this has not gone through extensive testing.

const regenerate = callback => {
	console.log('regenerating')
	callback()
}
const save = callback => {
	console.log('saving')
	callback()
}
app.use((req, res, next)=>{
	req.session.regenerate = regenerate
	req.session.save = save
	next()
})
app.use(passport.session())

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

No branches or pull requests

2 participants