Skip to content

Incorrectly parsed cookie #73

@LenweSaralonde

Description

@LenweSaralonde

I received these 2 cookies in a single line from a back end :

csrftoken=XXXXXXXX; expires=Fri, 11 Dec 2026 14:37:02 GMT; Max-Age=31449600; Path=/; SameSite=Strict; Secure, USER_SESSION_member_space=YYYYYYYY; expires=Sat, 13 Dec 2025 00:37:02 GMT; HttpOnly; Max-Age=36000; Path=/; SameSite=None; Secure

Result using parse method :

Parsed [
  [Object: null prototype] {
    name: 'csrftoken',
    value: 'XXXXXXXX',
    expires: 2025-12-13T00:37:02.000Z,
    maxAge: 36000,
    path: '/',
    sameSite: 'None',
    'secure, user_session_member_space': 'YYYYYYYY',
    httpOnly: true,
    secure: true
  }
]

Only the first cookie is parsed but with the expiration date of the second one.

I expect to have 2 cookies parsed with the correct expiration date.

Maybe this cookie string is not perfectly compliant but I tested it using this online tool https://rapidtoolset.com/en/tool/cookie-parser
and I got correct results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions