New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 596261 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Jul 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

window.fetch fails when using a relative url from the context of a url with inline HTTP basic credential

Reported by hmottes...@gmail.com, Mar 19 2016

Issue description

Chrome Version       : 49.0.2623.87 (64-bit)
URLs (if applicable) : https://test:test@www.google.no/
Other browsers tested:
  Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
     Safari: OK
    Firefox:
         IE:

What steps will reproduce the problem?
(1) Go to a webpage that uses https and inline basic credentials
(2) Execute in console: window.fetch(".")
(3) 

What is the expected result?
A GET request against https://www.google.no/. or https://test:test@www.google.no/.

What happens instead?
Error with message: Request cannot be constructed from a URL that includes credentials: .

Please provide any additional information below. Attach a screenshot if
possible.

Executing window.fetch(window.location.origin+".", {credentials: 'same-origin'}) will in fact work, however it gets stopped by CORS. I have check against a site with a lax CORS, and then it works fine.

 
Cc: brajkumar@chromium.org
Tested on Windows 7 using chrome latest stable M49-49.0.2623.87 by following steps mentioned below.

1. Navigated to https://www.google.no/
2. Switched to console and typed window.fetch(".")
3. Observed an error saying "Request cannot be constructed from a URL that includes credentials"

hmottestad@ Is this issue used to work before? If yes, do you remember on which version? Tested the same on previous version of chrome M35-35.0.1851.0 still unable to repro. So please let us know is this is a regression or non-regression.

Thanks!
Labels: Needs-Feedback
I just tested this is on v 48.0.2564.116 (64-bit) and it works fine.

I tried window.fetch(".") and window.fetch("/hello") and they both show up in the network logs (XHR) as http://test:test@www.google.no/ and http://test:test@www.google.no/hello respectively. 

If I add {credentials: 'same-origin'} it also sends the cookie. I also tested this on a site that requires http basic auth, and then it sends the correct Authorization header.

So this is a regression for me.
It is specified in https://fetch.spec.whatwg.org/#dom-request

  If parsedURL includes credentials, throw a TypeError.

and was implemented as https://chromium.googlesource.com/chromium/src/+/1c2ac08f854e4b5f668c8e8f148fcb6679d2e34e. I think it works as intended.
Components: Blink>Network>FetchAPI
I found that same code. And it does look intended. 

There doesn't seem to be an explanation for why the spec doesn't allow credentials, and it is probably an omission to not handle relative urls independently of absolute urls. Credentials in absolute urls may be bad. But relative urls only have credentials because of their base url, which is already ratified by the browser.  
Have you read below threads?

- https://github.com/whatwg/fetch/issues/26
- https://bugs.chromium.org/p/chromium/issues/detail?id=474439

If you want to change a spec-conformant behavior, the spec issue tracker would be the right place to talk.
Project Member

Comment 8 by sheriffbot@chromium.org, Mar 22 2016

Labels: -Needs-Feedback Needs-Review
Owner: ssamanoori@chromium.org
Status: Assigned (was: Unconfirmed)
Thank you for providing more feedback. Assigning to requester "ssamanoori@chromium.org" for another review.

For more details visit https://sites.google.com/a/chromium.org/dev/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Needs-Review Needs-Feedback
Owner: ----
Status: Unconfirmed (was: Assigned)
Tested the issue on Windows 7 using 49.0.2623.87, latest stable 49.0.2623.110 with below steps:

1.Opened URL: https://www.google.no/
2.Navigated to dev tools->console and typed 'window.fetch(".")'.
3.Observed the result as in screenshot.
4.Observed the same behavior in chrome 48.0.2564.116 version.

Please find attached screenshot and update if anything missed here in triaging the issue.

hmottestad@Could you please provide actual and expected behavior screenshots for better understanding the issue to triage it further.
596261.png
103 KB View Download
Try: https://test:test@www.google.no/
Project Member

Comment 11 by sheriffbot@chromium.org, Mar 29 2016

Labels: -Needs-Feedback Needs-Review
Owner: ssamanoori@chromium.org
Thank you for providing more feedback. Adding requester "ssamanoori@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://sites.google.com/a/chromium.org/dev/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Needs-Review Needs-Feedback
Owner: ----
Tested the issue on Windows 7 using 49.0.2623.87, latest stable 49.0.2623.110 with below steps:

1.Opened URL: https://test:test@www.google.no/
2.Navigated to dev tools->console and typed 'window.fetch(".")'.
3.Observed an error saying "Request cannot be constructed from a URL that includes credentials" in M-49.
4.Observed the differeny behavior in chrome 48.0.2564.116 version.
5.Observed different error in M-40 and M-30 versions of chrome.

hmottestad@Could you please provide expected behavior screenshot for better understanding the issue to triage it further.
Expected. 


Screen Shot 2016-03-31 at 20.41.40.png
33.3 KB View Download
Current behaviour.
Screen Shot 2016-03-31 at 20.43.05.png
69.2 KB View Download
ssamanoori@chromium.org

window.fetch("anything/goes/here") when on a page with inline basic auth worked fine in v48 but stopped working in v49. 

As pointed out by yhirano@chromium.org, this is actually spec compliant.

I very much disagree with the spec, since it breaks behaviour that works with XMLHttpRequest and breaks behaviour that is part of the http standard. I have aired by concerns on https://github.com/whatwg/fetch/issues/26. 
Project Member

Comment 16 by sheriffbot@chromium.org, Apr 1 2016

Labels: -Needs-Feedback Needs-Review
Owner: ssamanoori@chromium.org
Thank you for providing more feedback. Adding requester "ssamanoori@chromium.org" for another review and adding "Needs-Review" label for tracking.

For more details visit https://sites.google.com/a/chromium.org/dev/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Needs-Review Needs-Feedback
Owner: ----
Unable to reproduce the issue on Windows 7 using latest stable 49.0.2623.110, canary 51.0.2701.0 as per steps in comment #9.
Please find attached screenshot.

hmottestad@Could you please check the issue on clean profile and update your observations.
596261.png
111 KB View Download
Cc: hirosh...@chromium.org
Labels: -Needs-Feedback
Owner: yhirano@chromium.org
Status: Untriaged (was: Unconfirmed)
OK, I'm taking this bug but I will not change the implementation until the standard discussion settles.

I don't have a strong opinion which is right: hiroshige@, can you express your opinion on the github issue https://github.com/whatwg/fetch/issues/26?
Status: WontFix (was: Untriaged)
Close this issue as the spec issue is closed. https://github.com/whatwg/fetch/issues/26?#issuecomment-234557734

Sign in to add a comment