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

Incorrect parsing of cookies #212

Closed
bytesnz opened this issue Nov 19, 2024 · 4 comments
Closed

Incorrect parsing of cookies #212

bytesnz opened this issue Nov 19, 2024 · 4 comments

Comments

@bytesnz
Copy link

bytesnz commented Nov 19, 2024

Just came across a set-cookie header value that is not correctly parsed by 1.0.1. Presuming it is due to the HttpOnly attribute. I'm using cookie to parse cookies received during testing API endpoints in node, hence the receiving the HttpOnly attribute

import cookie from 'cookie';

const cookies = cookie.parse('s=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; Path=/; HttpOnly; SameSite=Strict, c=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy; Path=/; HttpOnly; SameSite=Strict');

results in

{
  s: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  Path: '/',
  SameSite: 'Strict, c=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
}
@wesleytodd
Copy link
Member

This package does not parse the set-cookie header. https://github.com/jshttp/cookie?tab=readme-ov-file#cookieparsestr-options

@wesleytodd
Copy link
Member

Maybe this will help? #213

@bytesnz
Copy link
Author

bytesnz commented Nov 19, 2024

Maybe this will help? #213

Yeah, that quick note will be perfect. My bad for not looking at previous issues. 🙇

@wesleytodd
Copy link
Member

No worries! It happens, and it spurred me to finally open that PR after seeing this question many times over many years. Cheers!

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