Closed
Bug 797204
Opened 12 years ago
Closed 12 years ago
Remove use of GetCxSubjectPrincipalAndFrame
Categories
(Core :: Security: CAPS, defect)
Core
Security: CAPS
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: bholley, Assigned: bholley)
References
Details
Attachments
(4 files, 2 obsolete files)
(deleted),
patch
|
mrbkap
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
bzbarsky
:
review+
justin.lebar+bug
:
feedback+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
mrbkap
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
Frame inspection needs to die for a number of reasons. It's not really IonMonkey-safe, and it goes against our new security model. There are only a handful of uses of this stuff left, so let's kill it.
Assignee | ||
Comment 1•12 years ago
|
||
Assignee | ||
Comment 2•12 years ago
|
||
These two functions do the exact same thing, as far as I can tell.
Attachment #667376 -
Flags: review?(mrbkap)
Assignee | ||
Comment 3•12 years ago
|
||
Attachment #667377 -
Flags: review?(justin.lebar+bug)
Assignee | ||
Comment 4•12 years ago
|
||
Per an IRC discussion with jlebar, this is what we're actually intending to
do here. Justin's original reasoning for this check is in bug 593174 comment 25.
Attachment #667378 -
Flags: review?(justin.lebar+bug)
Assignee | ||
Comment 5•12 years ago
|
||
Now with less voodoo!
Attachment #667379 -
Flags: review?(justin.lebar+bug)
Comment 7•12 years ago
|
||
> Part 2 - Fix incorrect test. v1
Can you check what the spec says and what other browsers do in this instance? This is a web-visible change of behavior, iiuc.
Assignee | ||
Comment 8•12 years ago
|
||
(In reply to Justin Lebar [:jlebar] from comment #7)
> Can you check what the spec says and what other browsers do in this
> instance? This is a web-visible change of behavior, iiuc.
I believe the change here is spec correct, since the referrer is supposed to come off the script entry point, and the script entry point gets set for event handlers. Let me work up a browser-neutral testcase.
Comment 9•12 years ago
|
||
Comment on attachment 667378 [details] [diff] [review]
Part 2 - Compare the document URI to the document principal, not the subject principal. v1
I've racked my brain and I /think/ this is right, but I'm not at all confident. I'd feel a lot better if Boris had a look.
Attachment #667378 -
Flags: review?(justin.lebar+bug)
Attachment #667378 -
Flags: review?(bzbarsky)
Attachment #667378 -
Flags: feedback+
Updated•12 years ago
|
Attachment #667377 -
Flags: review?(justin.lebar+bug)
Attachment #667377 -
Flags: review?(bzbarsky)
Attachment #667377 -
Flags: feedback+
Updated•12 years ago
|
Attachment #667379 -
Flags: review?(justin.lebar+bug)
Attachment #667379 -
Flags: review?(bzbarsky)
Attachment #667379 -
Flags: feedback+
Updated•12 years ago
|
Attachment #667376 -
Flags: review?(mrbkap) → review+
Comment 10•12 years ago
|
||
Comment on attachment 667380 [details] [diff] [review]
Part 4 - Remove API. v1
r=me assuming the rest of the patches shake out.
Attachment #667380 -
Flags: review?(mrbkap) → review+
Comment 11•12 years ago
|
||
Comment on attachment 667377 [details] [diff] [review]
Part 2 - Fix incorrect test. v1
r=me assuming that this matches behavior in other browsers.
Attachment #667377 -
Flags: review?(bzbarsky) → review+
Comment 12•12 years ago
|
||
Comment on attachment 667378 [details] [diff] [review]
Part 2 - Compare the document URI to the document principal, not the subject principal. v1
I guess this is fine, though this whole heuristic is kinda questionable in various ways. If we're happy looking at the _document_ principal, why not just go ahead and use the current URI of the document in all cases? I had sort of assumed that we weren't doing that precisely because the document principal could differ from the "principal" we see there...
Attachment #667378 -
Flags: review?(bzbarsky) → review+
Comment 13•12 years ago
|
||
Comment on attachment 667379 [details] [diff] [review]
Part 4 - Simplify calling doc logic in nsLocation. v1
Why is this doing GetDynamicScriptGlobal? It used to do GetStaticScriptGlobal. Why are we making that behavior change?
Assignee | ||
Comment 14•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #12)
> I guess this is fine, though this whole heuristic is kinda questionable in
> various ways. If we're happy looking at the _document_ principal, why not
> just go ahead and use the current URI of the document in all cases? I had
> sort of assumed that we weren't doing that precisely because the document
> principal could differ from the "principal" we see there...
Well, this check is determining whether the document principal matches the document URI (which it doesn't for the JSURI cases, apparently). It's not clear to me what else this check would mean in the modern world.
Assignee | ||
Comment 15•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #13)
> Why is this doing GetDynamicScriptGlobal? It used to do
> GetStaticScriptGlobal. Why are we making that behavior change?
The former song and dance with GetCxSubjectPrincipalAndFrame was actually giving us the frame of the caller, meaning that the call to GetStaticScriptGlobal would give us the document in the immediate calling frame.
So this does change behavior in the case that doc A calls into a function in doc B that sets location on doc C - previously, we'd use doc B for the URI check, and now we'll use doc A. But I'm pretty sure this change is spec correct.
Assignee | ||
Comment 16•12 years ago
|
||
(In reply to Bobby Holley (:bholley) from comment #15)
> So this does change behavior in the case that doc A calls into a function in
> doc B that sets location on doc C - previously, we'd use doc B for the URI
> check, and now we'll use doc A. But I'm pretty sure this change is spec
> correct.
Or maybe not. The spec says that referrer must be the |Source Browsing Context|, defined as "the browsing context which was responsible for starting the navigation". This is a bit ambiguous, but the distinction is web-visible in the "a calls b which navigates c" case. My tests indicate the following:
Firefox before my patch: referrer = b.html
Firefox after my patch: referrer = a.html
Webkit: referrer = b.html
Opera: referrer = a.html
The post-patch behavior is much nicer and more solid for us to implement, since we can implement it with the script entry point stack, as opposed to some kind of JS stack walking. But it seems like we should clear up the spec before proceeding here.
Assignee | ||
Comment 17•12 years ago
|
||
And in fact, clarifying the spec issue in comment 17 will answer Justin's question in comment 7. Is the referrer the script entry point, or the immediate caller?
Comment 18•12 years ago
|
||
Yep, comment 17 and comment 18 are spot on. What does IE do?
Assignee | ||
Comment 19•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #19)
> Yep, comment 17 and comment 18 are spot on. What does IE do?
a.html.
So Webkit and current firefox do b.html. Opera, IE, and post-patch Firefox do a.html.
Comment 20•12 years ago
|
||
"Lovely".
I'm probably ok to switching to a.html if we can convince WebKit to....
Assignee | ||
Comment 21•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #21)
> "Lovely".
>
> I'm probably ok to switching to a.html if we can convince WebKit to....
Ok, should I file a spec bug?
Comment 22•12 years ago
|
||
I'd start by mailing the whatwg list, I guess, and explicitly asking the WebKit folks.
Assignee | ||
Comment 23•12 years ago
|
||
Comment on attachment 667379 [details] [diff] [review]
Part 4 - Simplify calling doc logic in nsLocation. v1
I'm going to raise this as a spec issue. Cancelling the review for now.
Attachment #667379 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 24•12 years ago
|
||
This is an alternate approach that allows us to remove the API while maintaining
our existing behavior with respect to document.referrer. Flagging bz for review.
Attachment #669505 -
Flags: review?(bzbarsky)
Comment 25•12 years ago
|
||
Comment on attachment 669505 [details] [diff] [review]
Part 3 - Use JS_GetScriptedCaller instead of JSStackFrames in nsLocation. v1
r=me. Was "principal" unused at this point? I guess it was...
Attachment #669505 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 26•12 years ago
|
||
Had a green try push in comment 1, but I've munged these patches a bit, so let's just be sure.
https://tbpl.mozilla.org/?tree=Try&rev=7798c0611b22
Assignee | ||
Comment 27•12 years ago
|
||
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/238f3986fe71
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/c5760a66bfcf
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/798a316ebfaa
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/94317b3cb4d5
Assignee | ||
Updated•12 years ago
|
Attachment #667377 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #667378 -
Attachment description: Part 3 - Compare the document URI to the document principal, not the subject principal. v1 → Part 2 - Compare the document URI to the document principal, not the subject principal. v1
Assignee | ||
Updated•12 years ago
|
Attachment #667379 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #669505 -
Attachment description: Part 4 (alternate) - Use JS_GetScriptedCaller instead of JSStackFrames in nsLocation. v1 → Part 3 - Use JS_GetScriptedCaller instead of JSStackFrames in nsLocation. v1
Assignee | ||
Updated•12 years ago
|
Attachment #667380 -
Attachment description: Part 5 - Remove API. v1 → Part 4 - Remove API. v1
Comment 28•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/238f3986fe71
https://hg.mozilla.org/mozilla-central/rev/c5760a66bfcf
https://hg.mozilla.org/mozilla-central/rev/798a316ebfaa
https://hg.mozilla.org/mozilla-central/rev/94317b3cb4d5
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Assignee | ||
Comment 29•12 years ago
|
||
Comment on attachment 669505 [details] [diff] [review]
Part 3 - Use JS_GetScriptedCaller instead of JSStackFrames in nsLocation. v1
It looks like some of the ion-monkey stuff made this API pretty flakey and jit-dependent, so I think we should probably uplift this onto the branches. Flagging for approval.
[Approval Request Comment]
Bug caused by (feature/regressing bug #): IonMonkey and associated prep work
User impact if declined: potential jit-dependent crashes.
Testing completed (on m-c, etc.): m-c
Risk to taking this patch (and alternatives if risky): Low risk. Well-understood.
String or UUID changes made by this patch: None.
Attachment #669505 -
Flags: approval-mozilla-beta?
Attachment #669505 -
Flags: approval-mozilla-aurora?
Comment 30•12 years ago
|
||
(In reply to Bobby Holley (:bholley) from comment #30)
> Comment on attachment 669505 [details] [diff] [review]
> Part 3 - Use JS_GetScriptedCaller instead of JSStackFrames in nsLocation. v1
>
> It looks like some of the ion-monkey stuff made this API pretty flakey and
> jit-dependent, so I think we should probably uplift this onto the branches.
> Flagging for approval.
>
> [Approval Request Comment]
> Bug caused by (feature/regressing bug #): IonMonkey and associated prep work
> User impact if declined: potential jit-dependent crashes.
Would we have seen a top crash around this already, or would the crashes have had varying signatures?
Comment 31•12 years ago
|
||
Comment on attachment 669505 [details] [diff] [review]
Part 3 - Use JS_GetScriptedCaller instead of JSStackFrames in nsLocation. v1
Spoke with bholley - we'd be much more comfortable if we took this low-risk fix (not fixing this may cause unknown regressions). Thankfully it's early in the cycle, so let's take this.
Attachment #669505 -
Flags: approval-mozilla-beta?
Attachment #669505 -
Flags: approval-mozilla-beta+
Attachment #669505 -
Flags: approval-mozilla-aurora?
Attachment #669505 -
Flags: approval-mozilla-aurora+
Comment 32•12 years ago
|
||
Caught this too late for today's Beta 2 go to build, please get this landed asap so it will be in our next Beta.
Assignee | ||
Comment 33•12 years ago
|
||
(In reply to Lukas Blakk [:lsblakk] from comment #33)
> Caught this too late for today's Beta 2 go to build, please get this landed
> asap so it will be in our next Beta.
After some discussion we're less sure that we want to take this on branch. I'm looking into it.
Comment 34•12 years ago
|
||
(In reply to Bobby Holley (:bholley) from comment #34)
> After some discussion we're less sure that we want to take this on branch.
> I'm looking into it.
What is the result of your investigation? Are we going ahead with branch uplifts or not?
Assignee | ||
Updated•12 years ago
|
Attachment #669505 -
Flags: approval-mozilla-beta+
Attachment #669505 -
Flags: approval-mozilla-aurora+
Assignee | ||
Comment 35•12 years ago
|
||
(In reply to Lukas Blakk [:lsblakk] from comment #35)
> What is the result of your investigation? Are we going ahead with branch
> uplifts or not?
I think we should skip it for now.
You need to log in
before you can comment on or make changes to this bug.
Description
•