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

Multiline URL Encoded textarea injecting \r\n into strings #136

Open
dwarring opened this issue Apr 28, 2021 · 4 comments
Open

Multiline URL Encoded textarea injecting \r\n into strings #136

dwarring opened this issue Apr 28, 2021 · 4 comments

Comments

@dwarring
Copy link

I notice when I type newlines into a text area which is then posted in a form. The line breaks get URL encoded as %0D%0A (carriage-return/line-feed) (both in Chrome and FireFox). These are getting passed all the way through to the query response values.

See screen-shot:
image

@dwarring
Copy link
Author

Pretty sure issue is arising around

if $name.contains('%') {

Golfs down to:

my $name = "aa%0D%0Abb";
$name .= subst(:g, /'%' (<[A..Fa..f0..9]>**2)/, {
                            my $ord = :16(.[0].Str);
                            chr($ord)
                        });

dd $name;

producing: Str $name = "aa\r\nbb" (Rakudo 2021.04)

Looks like a Rakudo bug?

@jnthn
Copy link
Member

jnthn commented Apr 28, 2021

I'm curious, do browsers do this no matter what platform they are running on? I'm also curious if there's precedent for other HTTP libraries doing this normalization. (I can do my own research on both of those, just didn't have time yet.)

@dwarring
Copy link
Author

The serialization is being done via the Jquery serialize() method.

They refer to W3C Forms recommendations for application/x-www-form-urlencoded and multipart/form-data

@dwarring
Copy link
Author

dwarring commented May 2, 2021

Fwiw, have now fixed the real issue, a new-line handling bug in CSS::Grammar.

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