New issue
Advanced search Search tips

Issue 831169 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Post Request body with content type application/x-www-form-urlencoded not parsed in formData in extension using chrome.webRequest when content length of request more than 4096. Since version of Chrome 62

Reported by only4job...@gmail.com, Apr 10 2018

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

Steps to reproduce the problem:
1.Make chrome extension and in some .js file register chrome.webRequest.onBeforeRequest listener with option requestBody adding to callback params.

2. Make post request in browser with content type application/x-www-form-urlencoded (it is by default when you send data from form) and make sure that content length more than 4096. 

3. Display requestBody in chrome console. 

What is the expected behavior?
Data should parsed in FormData and appears in formData object with dataset presented as key=>value

What went wrong?
Since version of Chrome 62 data not parsed and appears in raw array with dataset presented as raw bytes.

Did this work before? Yes 61

Does this work in other browsers? N/A

Chrome version: 65.0.3325.181  Channel: stable
OS Version: Ubuntu 16.04
Flash Version: 

We have working production chrome extension using chrome.webRequest logic. And it's important to understand how we can fix it not making big changes in code. 

So my question are: 
1. What the updates was in 62 version of chrome which led to such changes in behavior?
2. How can we fix this ?
 

Comment 1 by woxxom@gmail.com, Apr 10 2018

Related:  issue 777898 .
Labels: Needs-Bisect Needs-Triage-M65
Cc: phistuck@gmail.com viswa.karala@chromium.org
Components: Platform>Extensions>API
Labels: Triaged-ET Needs-Feedback
As per comment#1, tested the issue:  831169  with reference to issue:  777898  using Ubuntu 14.04 with steps mentioned below:
1) Launched chrome reported version 65.0.3325.181 and installed the extension given in Issue:  777898  > comment# 6
2) In new tab page given "data:text/html,<form method="post" name="crap" action="http://phistuck-app.appspot.com" target="fff"><input name=f value=fdfdsf><input type=submit></form>" and submitted the form, after submitting in new tab page seen "405 Method Not Allowed"
3) Opened chrome://extensions, clicked on "background page" on installed extension
4) In Devtools > Console observed Object is generated

@Reporter: Please find the attached screen cast for your reference and provide your feedback on it which help in further triaging it.
Could you please provide sample test file/URL which reproduces the issue and if possible provide the screen cast of the issue which helps in better understanding and could you please confirm if this issue is specific to Ubuntu 16.04.
Note: With reference to the Issue:  777898 , CC'ing: phistuck@gmail.com and tentatively adding Platform>Extensions>API component.

Thanks!

831169.ogv
6.4 MB View Download
I don't think this bug specific to Ubuntu 16.04. 

All works fine if doing steps you proposed. It's because few data in request. 

To reproduce this bug add more data to input. It need to be enough to make content-length of request more than 4096 characters. 
Try this form "data:text/html,<form method="post" name="crap" action="http://phistuck-app.appspot.com" target="fff"><input name=f value=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa><input type=submit></form>"

Please see screenshots.
bug_formData.jpg
1.4 MB View Download
bug_raw.jpg
1.2 MB View Download
Project Member

Comment 5 by sheriffbot@chromium.org, Apr 11 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Pri-2 -Needs-Bisect hasbisect-per-revision Target-67 RegressedIn-62 Target-66 M-67 FoundIn-66 FoundIn-67 Target-65 FoundIn-65 OS-Mac OS-Windows Pri-1
Owner: fmalita@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce the issue on reported version 65.0.3325.181 and latest chrome 67.0.3394.0 using Mac 10.12.6, Ubuntu 14.04 and Windows-10, hence providing Bisect Info
Bisect Info:
================
Good build: 62.0.3165.0
Bad build: 62.0.3166.0

You are probably looking for a change made after 488999 (known good), but no later than 489000 (first known bad).

https://chromium.googlesource.com/chromium/src/+log/dd98915460f476bb1097e5814a29491c16b94ac3..a7ecc49b7b45c8988d280ea74cf0c4c9d8f0d16c

Reviewed-on: https://chromium-review.googlesource.com/581748

@Florin Malita: Please confirm the issue and help in re-assigning if it is not related to your change.

Thanks!
Status: Started (was: Assigned)
@phistuck thanks for following up.

This does look like an unintended side-effect of my change: we're pushing segmented data further down the stack (instead of flattening upstream), and apparently the formData builder doesn't know how to handle it.

Just to clarify: this is solely an issue with chrome.webRequest/formData, and not with the actual POST request, right?

I'm asking because your "correct"/formData screenshot shows "Content-Length: 4096", which seems wrong: the form data in c#4 is 4095 bytes + "f=" prefix => 4097 content length.  4097 is also what I'm seeing prior to my change, see attached.  Maybe you were posting fewer bytes when you took that screenshot?
content-length-formData.png
152 KB View Download
Yes. this is solely an issue with chrome.webRequest/formData.
With request I'm just want to show that the issue becomes from certain data volumes.
Project Member

Comment 9 by bugdroid1@chromium.org, Apr 17 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/afccef39a889d2659ca7cdee3dd2b59c3b7adc3d

commit afccef39a889d2659ca7cdee3dd2b59c3b7adc3d
Author: Florin Malita <fmalita@chromium.org>
Date: Tue Apr 17 15:44:26 2018

Fix parsing of segmented WebRequest formData

After https://chromium-review.googlesource.com/c/chromium/src/+/581748
we no longer flatten SharedBuffers in GetRequestBodyForWebHTTPBody()
but instead pass segmented data downstream (multiple DataElements).

This minimizes unnecessary reallocations/copies in general, but relies
on downstream clients being able to handle segmented data (or flatten it
on the fly if really needed).

Turns out WebRequest's FormDataParsers assume the input buffers are
flattened (or segmented along expected chunk boundaries for multipart).

This CL adds a buffering mechanism to ParsedDataPresenter which flattens
consecutive byte segments before passing down to the parser.

BUG= 831169 

Change-Id: Ibea9193ff783cad0c80bb9722f719ff063b65720
Reviewed-on: https://chromium-review.googlesource.com/1011322
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551344}
[modify] https://crrev.com/afccef39a889d2659ca7cdee3dd2b59c3b7adc3d/extensions/browser/api/web_request/upload_data_presenter.cc
[modify] https://crrev.com/afccef39a889d2659ca7cdee3dd2b59c3b7adc3d/extensions/browser/api/web_request/upload_data_presenter.h
[modify] https://crrev.com/afccef39a889d2659ca7cdee3dd2b59c3b7adc3d/extensions/browser/api/web_request/upload_data_presenter_unittest.cc

Status: Fixed (was: Started)
Installed the latest stable version of chromium (version 66). 
As before, the data from the form does not come in FormData but in the Raw array of bytes when content-length more than ~4096 (in chrome extension using chrome.webRequest.onBeforeRequest).

Please tell with what version of chromium and chrome should expect fixing of this bug ?


Comment 12 by woxxom@gmail.com, May 21 2018

The fix landed in 68.0.3399.0. It wasn't merged to 67, not even considered. The reason is unknown.
Cc: -phistuck@gmail.com
#11 - Chrome 68 should have it.

#7 - I did not follow up. ;)

Comment 14 by phistuck@gmail.com, May 21 2018

#12 - it is a not critical bug, it is a relatively old regression and I guess there were not a lot of complaints, so merging is not warranted. They tend to be picky.
So, just to clarify, this bug will be fixed in 68 version. Correct ?

Comment 16 by woxxom@gmail.com, May 23 2018

It's already fixed in Chrome 68.
Ok. Thank You !

Sign in to add a comment