How can I differentiate a tampered signed cookie from a `false` JSON cookie?
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Active
- Tech stack
- javascript, node.js
- Domain
- backend
Research direction
Start by reviewing the cookie-parser documentation for signed cookies and JSON cookies, then reproduce the collision between a valid signed j:-prefixed false value and a failed signature. Determine whether the current API exposes enough information to distinguish them; document the finding or define the required behavior and its verification cases.
Written by the indexing model from the issue text.
Description
Forewarning: I am extremely new to Node.js and NPM.
From reading the documentation of cookieParser, it appears that cookies that are signed but fail validation are assigned false in the req.signedCookies object.
Signed cookies that fail signature validation will have the value
falseinstead of the tampered value.
Also, cookies prefixed with j: are automatically parsed with JSON.parse.
In addition, this module supports special "JSON cookies". These are cookie where the value is prefixed with
j:. When these values are encountered, the value will be exposed as the result ofJSON.parse.
However, the string 'false' is valid JSON, so it should get parsed to false. I also found no option to disable the built-in JSON parser. How can I differentiate a valid signed j:'false' cookie from an invalid signed cookie?
If this is not possible, I request that this be relabeled to a bug report or feature request.
- Dominant language
- JavaScript
- Stars
- 2k
- Forks
- 237
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from expressjs/cookie-parser
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
expressjs/cookie-parser#138 ·
-
req.cookies is showing nullPossibly taken @D-393Patel claimed this 372 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
expressjs/cookie-parser#128 ·
-
perf: limit cookie parse only on some cookiePossibly taken @cesco69 claimed this 584 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 42/100
expressjs/cookie-parser#126 · 1 reaction ·
-
future question
Difficulty 5/5 Over a week Newbie friendliness 25/100
expressjs/cookie-parser#124 · 7 reactions ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 20/100
expressjs/cookie-parser#122 · 5 comments ·
All issues in expressjs/cookie-parser
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
OWASP/CheatSheetSeries#3018 ·
Maintainers usually reply within 1 day
-
Radix number block generates NaN after switching a negative or decimal number to binary, octal or hexPossibly taken @matthewalberto claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
mit-cml/appinventor-sources#4246 · 1 comment ·
Maintainers usually reply within 1 day
-
marketing
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 83/100
GoogleChrome/modern-web-guidance-src#3675 · 2 comments ·
Maintainers usually reply within 1 day