-
Notifications
You must be signed in to change notification settings - Fork 48
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
escaping of reserved characters #18
Comments
There is definitely a problem here. |
This should fix the problem |
@awalterschulze yes I can see that will fix the issue, but wouldn't be best to simply perform URL encoding when the |
Sorry I am really a noob web programmer. Wouldn't it make the rest of the url less readable/hackable? |
I don't want this
To reslut in
|
@awalterschulze well, if you are missing other sequences that need escaping, it will simply break. I suggest to use the correct JavaScript function encodeURIComponent and then if you want to have some characters encoded by the browser (that's what happens when you type them non-encoded, and when it doesn't happen it just breaks server-side as per OP) you can replace after the call to the proper encoding function. The list of reserved characters is here for example: https://en.wikipedia.org/wiki/Percent-encoding |
I am going on holiday, but I'll be back in about a week, then I'll look at this again. |
Yes if there are other sequences that require escaping it will break :( I am struggling to understand the second paragraph. The wikipedia page says that encodeURIComponent is a non-standard function, or am I reading it wrong? Reserved characters that don't cause problems
Reserved characters that cause problems
Reserved characters that cause problems that have been fixed
Percent is also a problem, but has now been fixed
But I haven't taken into account character sequences. |
@awalterschulze sorry, this issue went out of my radar. The wikipedia page says
I think you're reading it wrong :) It's referring to unicode not specifically to the encodeURIComponent function which is standard since ECMA3, a summary is here: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent What is non-standard is not encoding some characters, because browsers might vary in the way of handling it. But let's say that letmegrpc is only supposed to be used with a few browsers that do support our hack with some characters, then what I proposed before in that 2nd paragraph was:
What I mean in (2) is that you have some decoding with a simple string replacement (it's safe to do on an encoded string). Example snippet:
I would still suggest to limit the replacement, leaving out of this 2nd-pass replacement |
Ok so you want to use encodeURIComponent and then "decode" some of the encoded characters? |
@awalterschulze yes that! :) |
Ok so characters that would be decoded include:
Does that sound about right? |
If you use '%' in any string field, the character will not be correctly escaped when passed via the
json
GET querystring parameter.This is the diff I used to narrow down the bug:
The text was updated successfully, but these errors were encountered: