Closed
Bug 733636
Opened 14 years ago
Closed 12 years ago
Flip security-wrapper default for nsContentUtils::WrapNative
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
FIXED
mozilla30
People
(Reporter: jaws, Assigned: mccr8)
References
Details
Attachments
(2 files, 3 obsolete files)
|
12.21 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
|
1.24 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
STR:
1) Apply patch 1
2) Apply patch 2
3) Rebuild the browser
4) Go to http://people.mozilla.org/~mwargers/tests/plugins/flash/flashembed.html
5) Using the doorhanger, activate the plugins on the page.
| Reporter | ||
Comment 1•14 years ago
|
||
Comment 2•14 years ago
|
||
Bobby, the reason I am pretty sure this is an xpconnect bug is that we have a call to WrapNative(cx, scope, supports, vp) where the compartment of cx and scope match but the outgoing vp is in a different compartment. I thought this might actually be the same issue as some of these c-p-g issues you've been uncovering.
Comment 3•14 years ago
|
||
Stack?
| Reporter | ||
Comment 4•14 years ago
|
||
Comment 5•14 years ago
|
||
So I stepped through the test case here. As it turns out, the call to nsContentUtils::WrapNative actually takes an optional final argument, aAllowWrapping, which defaults to false. This causes XPCConvert::NativeInterface2JSObject to skip the wrapping phase, causing an unwrapped cross-compartment object to be returned.
So Jared, the easy solution for now is to pass true as the final argument to nsContentUtils::WrapNative.
Blake, this seems pretty foot-gun. Do we have a reason for this parameter, and especially a reason for it to default to false? I can understand it in the pre-compartment days (not wanting security wrappers), but now we really need them to do anything with the JS Object. Is this something we can change?
| Reporter | ||
Comment 6•14 years ago
|
||
(In reply to Bobby Holley (:bholley) from comment #5)
> So Jared, the easy solution for now is to pass true as the final argument to
> nsContentUtils::WrapNative.
Thanks! That fixed it for me :-)
Comment 7•14 years ago
|
||
(In reply to Bobby Holley (:bholley) from comment #5)
> Blake, this seems pretty foot-gun.
No kidding! (Might as well call it aAllowCrossCompartmentAssertions ;)
| Reporter | ||
Updated•14 years ago
|
Attachment #603539 -
Attachment is patch: false
| Reporter | ||
Updated•14 years ago
|
Attachment #603540 -
Attachment is patch: false
Comment 8•14 years ago
|
||
If I remember correctly, that flag is useful in one case: where we actually want the XPCWrappedNative C++ object for one reason or another. The other can I can think of is PreCreate hooks, where we need the parent object's JS object and not a wrapper around it in order to tell XPConnect which compartment we actually belong in.
We can definitely change the default, though.
Comment 9•14 years ago
|
||
Or perhaps add a new function altogether with a scary name...
Updated•13 years ago
|
Summary: Compartment mismatch where object from WrapNative does not have the same compartment as the global object → Flip security-wrapper default for nsContentUtils::WrapNative
| Assignee | ||
Updated•13 years ago
|
Attachment #603539 -
Attachment is obsolete: true
| Assignee | ||
Updated•13 years ago
|
Attachment #603572 -
Attachment is obsolete: true
| Assignee | ||
Updated•13 years ago
|
Attachment #603540 -
Attachment is obsolete: true
Updated•13 years ago
|
Blocks: CVE-2013-1730
| Assignee | ||
Comment 11•12 years ago
|
||
Attachment #8375035 -
Flags: review?(bobbyholley)
| Assignee | ||
Comment 12•12 years ago
|
||
Attachment #8375036 -
Flags: review?(bobbyholley)
Comment 13•12 years ago
|
||
Comment on attachment 8375035 [details] [diff] [review]
part 1 - Change the nsContentUtils::WrapNative aAllowWrapping default to true.
Review of attachment 8375035 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for pushing this through Andrew.
Attachment #8375035 -
Flags: review?(bobbyholley) → review+
Updated•12 years ago
|
Attachment #8375036 -
Flags: review?(bobbyholley) → review+
| Assignee | ||
Comment 14•12 years ago
|
||
Comment 15•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/387b5a9167b0
https://hg.mozilla.org/mozilla-central/rev/e9378c4abc75
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in
before you can comment on or make changes to this bug.
Description
•