Closed Bug 1158208 Opened 9 years ago Closed 9 years ago

Enforce that tiles HTTP requests don't have cookies

Categories

(Firefox :: New Tab Page, defect)

defect
Not set
normal
Points:
3

Tracking

()

RESOLVED FIXED
Firefox 41
Iteration:
41.1 - May 25
Tracking Status
firefox41 --- fixed

People

(Reporter: benjamin, Assigned: Mardak)

References

Details

(Whiteboard: .?)

Attachments

(2 files, 2 obsolete files)

Currently tiles makes the following HTTP(s) requests:

* requesting the source JSON document
* requesting the tile images
* sending the data JSON ping

Right now we promise that the servers will not set cookies for each of these requests. We should enforce on the client that we don't ever send cookies with these requests. I believe that we have a way to do this already, but I don't remember/can't find the details.
Just found XHR.mozAnon, which is what we should be using.
Whiteboard: .?
Blocks: 1158230
Component: Tiles → New Tab Page
Product: Content Services → Firefox
Attached patch v1 (obsolete) — Splinter Review
Some reason it looks like the internal interface doesn't allow parameters but the webidl interface does:

http://mxr.mozilla.org/mozilla-central/source/dom/base/nsXMLHttpRequest.h#208

So to get the appropriate constructor, I grabbed XHR from the hidden window.
Assignee: nobody → edilee
Status: NEW → ASSIGNED
Attachment #8604386 - Flags: review?(adw)
Attachment #8604386 - Attachment description: bug1158208.patch → v1
Attached patch v1.1 (obsolete) — Splinter Review
Update docs
Attachment #8604386 - Attachment is obsolete: true
Attachment #8604386 - Flags: review?(adw)
Attachment #8604387 - Flags: review?(adw)
Comment on attachment 8604387 [details] [diff] [review]
v1.1

Review of attachment 8604387 [details] [diff] [review]:
-----------------------------------------------------------------

There may be a "more correct" way to do this using nsIRequest/nsIChannel and load flags like LOAD_ANONYMOUS (which I bet is what this XHR mozAnon boils down to), but this is fine with me.

::: browser/modules/DirectoryLinksProvider.jsm
@@ +347,5 @@
>    /**
> +   * Create a new XMLHttpRequest that is anonymous, i.e., doesn't send cookies
> +   */
> +  _newXHR() {
> +    // Use XHR with WebIDL that accepts extra parameters

Could you please make it more clear that only the WebIDL XHR appears to support mozAnon?
Attachment #8604387 - Flags: review?(adw) → review+
Depends on: 1163898
Meh. My hack isn't super useful because... there's no hidden window from xpcshell tests! ;)

Perhaps I can try/catch hidden window and fall back to createInstance. xpcshell test won't pass mozAnon == true but mochitest should....
Attached patch v1.2 brokenSplinter Review
Just to attach this for now..
Attachment #8604387 - Attachment is obsolete: true
This depends on bug 1163898, which will probably be difficult to uplift to 40/39, so perhaps we'll just ride the trains on this functionality in 41.
Attachment #8604771 - Flags: review?(adw)
Comment on attachment 8604771 [details] [diff] [review]
v2 depends on bug 1163898

Review of attachment 8604771 [details] [diff] [review]:
-----------------------------------------------------------------

You could do both and uplift the hidden window one.  The test coverage isn't really buying much anyway.
Attachment #8604771 - Flags: review?(adw) → review+
To be clear, it's not entirely straightforward to just use hidden window fix because various xpcshell tests rely on XHR object existing (not just the newly added test-anonymous), but trying to access hiddenwindow.XHR throws.
Iteration: --- → 41.1 - May 25
Points: --- → 3
ni? per https://wiki.mozilla.org/Firefox/Data_Collection

(In reply to Pulsebot from comment #9)
> https://hg.mozilla.org/integration/mozilla-inbound/rev/cca3ce6947c2
No additional data is being collected. Firefox is adding an extra no-cookie safeguard, so updating .rst.
Flags: needinfo?(benjamin)
f+
Flags: needinfo?(benjamin)
https://hg.mozilla.org/mozilla-central/rev/cca3ce6947c2
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 41
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: