allow to configure toInternalRequest to not decode the value of cookies #7675
krzysztof-kabat-mns
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description 📓
/packages/core/src/lib/web.ts
is converting request to internal request usingtoInternalRequest
and as a part of this conversion its also parsing cookies usingcookies
npm module. The issue we discovered is that when parsing those cookies it also usesdecodeURIComponent
. This however can cause an issue in situations where the value of the cookie is not encoded withencodeURIComponent
but for example some similar encoder that happens to use % encoding. The result is that the cookie value will be corrupted.The preferred way would be either to not decode that value and leave it as is for user to consume.
If its not possible for backward compatibility reasons, please allow a configuration parameter that can specify a decoding function, where user can specify no-op function.
One potential way would be to pass the config:
How to reproduce ☕️
+donotdecodetoken%2B
req.cookies
to read the value.Expected outcome:
+donotdecodetoken%2B
Actual outcome:
+donotdecodetoken+
which is exactlydecodeURIComponent('+donotdecodetoken%2B')
Contributing 🙌🏽
Yes, I am willing to help implement this feature in a PR
Beta Was this translation helpful? Give feedback.
All reactions