Closed
Bug 962365
Opened 12 years ago
Closed 9 years ago
Isolate/double-key the image cache to first party URI
Categories
(Core :: Graphics: ImageLib, defect, P2)
Core
Graphics: ImageLib
Tracking
()
RESOLVED
DUPLICATE
of bug 1270680
People
(Reporter: mikeperry, Assigned: huseby)
References
(Blocks 1 open bug)
Details
(Whiteboard: [tor][ETA 10/10])
Attachments
(2 files, 4 obsolete files)
59.86 KB,
patch
|
Details | Diff | Splinter Review | |
28.25 KB,
patch
|
Details | Diff | Splinter Review |
As part of the third party tracking protections in Tor Browser, we patched the image cache to support double-keying, to allow it to be isolated to the url bar domain.
We did this prior to the multi-window private browsing support. Not sure if the approach used to isolate the image cache for PBM can be extended to all first parties (with an additional PBM vs non-PBM flag), or if our more invasive approach is still the way to go.
The patch is against FF24ESR and has been deployed in Tor Browser for a while now.
Updated•12 years ago
|
Component: General → ImageLib
Product: Firefox → Core
Updated•12 years ago
|
OS: Windows 7 → All
Hardware: x86 → All
Updated•12 years ago
|
Whiteboard: [tor]
Comment 1•10 years ago
|
||
Here's a link that tracks the latest version of the Tor Browser patch:
https://torpat.ch/6539
and here are the regression tests:
https://torpat.ch/13749
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → huseby
Assignee | ||
Comment 2•9 years ago
|
||
This patch adds origin attributes to the ImageCacheKey class. Now I just need to fix up the callers.
Assignee | ||
Comment 3•9 years ago
|
||
this is mostly done. i just need to figure out how to get the origin attributes in one specific place...right where it fails to compile. i'm going to need some review on the principal i chose to use in another place. i marked it with //XXX(huseby).
Attachment #8739626 -
Attachment is obsolete: true
Assignee | ||
Comment 4•9 years ago
|
||
this patch probably works.
Attachment #8739644 -
Attachment is obsolete: true
Assignee | ||
Comment 5•9 years ago
|
||
compiles and doesn't crash. this ensures that all calls to LoadImage have a principal associated with the load so that we can isolate image caching by origin attributes.
Attachment #8739771 -
Attachment is obsolete: true
Assignee | ||
Comment 6•9 years ago
|
||
Arthur,
This is my first pass at origin attribute based image cache isolation. This should demonstrate how origin attributes can be used for this kind of thing. ATM, the unit tests are failing but that's probably a test bug. Let me know what you think.
--dave
Attachment #8739867 -
Attachment is obsolete: true
Attachment #8739908 -
Flags: feedback?(arthuredelstein)
Comment 7•9 years ago
|
||
(In reply to Dave Huseby [:huseby] from comment #6)
> Created attachment 8739908 [details] [diff] [review]
> image isolation with origin attributes
>
> Arthur,
>
> This is my first pass at origin attribute based image cache isolation. This
> should demonstrate how origin attributes can be used for this kind of thing.
> ATM, the unit tests are failing but that's probably a test bug. Let me know
> what you think.
>
> --dave
I'm very excited to see this. :)
Have you tried Tor Browser's "cache" regression test here:
https://torpat.ch/13749
You can change the `suffixes` part to
+ suffixes = ["img.png", "object.png", "embed.png"];
so it will be testing image caching only.
>diff --git a/toolkit/system/gnome/nsAlertsIconListener.cpp b/toolkit/system/gnome/nsAlertsIconListener.cpp
>index 154630d..894f434 100644
[snip]
>+ nsCOMPtr<nsIScriptSecurityManager> ssm = nsContentUtils::GetSecurityManager();
>+ NS_ENSURE_TRUE(ssm, NS_ERROR_FAILURE);
>+ nsCOMPtr<nsIPrincipal> systemPrincipal;
>+ ssm->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
>+ NS_ENSURE_TRUE(systemPrincipal, NS_ERROR_FAILURE);
>+
> nsresult rv = il->LoadImageXPCOM(imageUri, nullptr, nullptr,
>- NS_LITERAL_STRING("default"), nullptr, nullptr,
>- this, nullptr,
>+ NS_LITERAL_STRING("default"),
>+ systemPrincipal, nullptr, this, nullptr,
> aInPrivateBrowsing ? nsIRequest::LOAD_ANONYMOUS :
> nsIRequest::LOAD_NORMAL,
> nullptr, 0 /* use default */,
> getter_AddRefs(mIconRequest));
Using the system principal here means that alert images aren't isolated to first party, correct? Is there a way to get the content principal? I think we didn't manage to do this yet in Tor Browser, but it would be good to fix that. See https://trac.torproject.org/15569
>diff --git a/widget/cocoa/nsMenuItemIconX.mm b/widget/cocoa/nsMenuItemIconX.mm
>index 1247f82..2c7bc7e26 100644
>--- a/widget/cocoa/nsMenuItemIconX.mm
>+++ b/widget/cocoa/nsMenuItemIconX.mm
>@@ -304,19 +304,25 @@ nsMenuItemIconX::LoadIcon(nsIURI* aIconURI)
[snip]
>+ nsCOMPtr<nsIScriptSecurityManager> ssm = nsContentUtils::GetSecurityManager();
>+ NS_ENSURE_TRUE(ssm, NS_ERROR_FAILURE);
>+ nsCOMPtr<nsIPrincipal> systemPrincipal;
>+ ssm->GetSystemPrincipal(getter_AddRefs(systemPrincipal));
>+ NS_ENSURE_TRUE(systemPrincipal, NS_ERROR_FAILURE);
>+
> nsresult rv = loader->LoadImage(aIconURI, nullptr, nullptr,
> mozilla::net::RP_Default,
>- nullptr, loadGroup, this,
>+ systemPrincipal, loadGroup, this,
> nullptr, nsIRequest::LOAD_NORMAL, nullptr,
> nsIContentPolicy::TYPE_INTERNAL_IMAGE, EmptyString(),
> getter_AddRefs(mIconRequest));
Here as well -- is it not dangerous to use the system principal here? I'm worried that this icon could come from content and needs to be isolated to first party. In the Tor Browser version of this patch (https://torpat.ch/6539), Kathy and Mark used the pre-existing `document` variable in this function to obtain the first-party.
Updated•9 years ago
|
Attachment #8739908 -
Flags: feedback?(arthuredelstein)
Assignee | ||
Updated•9 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee | ||
Comment 8•9 years ago
|
||
unassigned from my list so that tim, yoshi, or jonathan can pick this up.
Assignee: huseby → nobody
Status: ASSIGNED → NEW
Updated•9 years ago
|
Blocks: ContextualIdentity
Whiteboard: [tor] → [tor][OA]
Assignee | ||
Updated•9 years ago
|
Summary: Isolate/double-key the image cache to first party URI → Isolate/double-key the image cache to use origin attributes.
Updated•9 years ago
|
Whiteboard: [tor][OA] → [tor][OA][userContextId]
Updated•9 years ago
|
Summary: Isolate/double-key the image cache to use origin attributes. → Isolate/double-key the image cache to first party URI
Updated•9 years ago
|
Whiteboard: [tor][OA][userContextId] → [tor][OA]
Updated•9 years ago
|
Assignee: nobody → jhao
Assignee | ||
Updated•9 years ago
|
Priority: -- → P1
Updated•9 years ago
|
Whiteboard: [tor][OA] → [tor]
Updated•9 years ago
|
Whiteboard: [tor][10/10] → [tor][ETA 10/10]
Updated•9 years ago
|
Priority: P1 → P2
Assignee | ||
Updated•9 years ago
|
Assignee: jhao → huseby
Assignee | ||
Comment 9•9 years ago
|
||
tanvi,
i just want to double check with you that the image cache isolation with origin attributes has already landed. if so, then this bug is redundant/unnecessary because once the firstPartyDomain origin attribute patch lands, then first party domain isolation of image cache will come for free.
Flags: needinfo?(tanvi)
Assignee | ||
Updated•9 years ago
|
Status: NEW → ASSIGNED
Comment 11•9 years ago
|
||
So this bug should be resolved already.
Bug 1264572 will verify this.
You need to log in
before you can comment on or make changes to this bug.
Description
•