New issue
Advanced search Search tips

Issue 602925 link

Starred by 4 users

Issue metadata

Status: Available
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Measure how many pages are using cross-origin XHR with credentials

Project Member Reported by tyoshino@chromium.org, Apr 13 2016

Issue description

To provide data points to the discussion at https://github.com/whatwg/fetch/issues/251#issuecomment-202304702 about XHR spec, we'd like to gather a metric how many pages are using cross-origin XHR with withCredentials set to true.

This UMA item doesn't need to live for long time. Once data is obtained, remove.
 
Components: Blink>Network>XHR
We can calculate the ratio by comparing the value for the new counter against sum of 
XMLHttpRequestAsynchronous and XMLHttpRequestSynchronous.
@tyoshino, do we have any way of determining, for a given request, whether the withCredentials flag NEEDED to be set? IOW, can we see whether the request ACTUALLY passed any credential-related information and/or whether the response included Access-Control-Allow-Credentials: true?

It would be useful (I think) to know whether withCredentials is being set by the client because the developer KNOWS that she will be passing credentials or whether it's just being set because the developer doesn't understand the CORS requirement (or perhaps just copied an existing bit of code).

Does that make sense?
Yeah. I was also worried about the possibility that people are using some library or c&p code as you said with withCredentials just always set. But in Chrome, actual cookie generation, etc. happens inside net/ stack which is abstracted away from our Blink rendering engine. It would be more work to exchange the initiator information (XHR/Fetch is involved, some credentials were sent). So, let me just start with this method.
Included from branch 2710. From data for 52.0.2710.0 (canary),

XMLHttpRequestCrossOriginWithCredentials / (XMLHttpRequestAsynchronous + XMLHttpRequestSynchronous) = ~30%

It's a lot.
I would have guessed slightly lower - about 25% - but it's in the ballpark of what I would have guessed.

I was (am) involved in some discussions on the WHATWG forums (https://github.com/whatwg/fetch/issues/251), where I said that my gut feeling is that the percentage of credentialed requests is higher than many people assume. This was in relation to the idea of making some of the new CORS features available for credentialed requests, since otherwise they wouldn't get the benefit.

Not that this proves anything (as you say, this is only on a canary release, so we can't extrapolate too much)...
Owner: ----
Status: Available (was: Started)
The WHATWG issue has been closed.

For the record, these are the metrics used in the comment 6.
https://www.chromestatus.com/metrics/feature/timeline/popularity/1305
https://www.chromestatus.com/metrics/feature/timeline/popularity/677
https://www.chromestatus.com/metrics/feature/timeline/popularity/465

We could remove the histogram item now.

Sign in to add a comment