This works on fx188.8.131.52, fx1.0.8 and moz1.7.13.
This works on fx2.0a1, fx184.108.40.206, fx220.127.116.11, fx1.0.8 and moz1.7.13.
This works on trunk, fx2.0a1, fx18.104.22.168, fx22.214.171.124, fx1.0.8 and moz1.7.13.
When a user left-clicks, selects text or presses Ctrl+A, the safe context that comes from the hidden window is used to call listener.notifySelectionChanged(). On Windows and Linux, the hidden window's url is resource://gre/res/hiddenWindow.html. But, on Mac, it is chrome://global/content/hiddenWindow.xul. Does that mean the safe context's global object has chrome privileges on Mac? If so, is it possible to trigger the code execution PoCs in this bug by left-clicking, selecting text or pressing Ctrl+A?
So... this method (and possibly the whole api) looks like it should just be noscript, imo. The only script we have that uses it is the two copies of viewsource.js; we could add another API they can call (one that will check that the caller has UniversalXPConnect privileges or something). Or would making an interface noscript be an API change? In that case we should just change this method to do the UniversalXPConnect check and add a noscript method for all the C++ callers.
I don't like using [noscript] to carry security information like "not suitable for unprivileged script" -- an implementation of that interface could certainly behave appropriately in the face of an unprivileged caller. So let's put the security checks in, but why would the C++ callers need to call something else? They should have privs, and be able to express that (possibly with a helper to push the right principal?), I think.
> They should have privs Generally speaking, in the current state of our security architecture, any C++ call to any function that does a security check against the subject principal should assume that the subject can be anything from chrome to the null principal. You're right that helpers to push the null principal might work here. We could do this in that case; we'd need to modify almost all callsites for this API, create the helpers for pushing the null principal, make those accessible from a variety of modules, add a fair amount of codesize, etc. I have yet to see a decent workable mockup of this even with codesize considerations excluded. We'd also need to document the security restrictions in the API somehow, of course, but I suppose we could use comments. If we can find someone to do all this, on trunk and all branches, I agree it would be better than my proposal...
So... I can't reproduce with testcase 3 on trunk. I get no alert, no security errors, nothing. I'll post a patch that should fix this and even make shaver somewhat happy. ;) But I can't really test it well, since I can't reproduce the bug.
Attachment #221219 - Attachment is obsolete: true
Attachment #221220 - Flags: superreview?(shaver)
Attachment #221220 - Flags: review?(jst)
Attachment #221220 - Flags: approval126.96.36.199?
Attachment #221220 - Flags: approval-branch-1.8.1?(jst)
Attachment #221219 - Flags: superreview?(shaver)
Attachment #221219 - Flags: review?(jst)
Attachment #221219 - Flags: approval188.8.131.52?
Attachment #221219 - Flags: approval-branch-1.8.1?(jst)
Comment on attachment 221220 [details] [diff] [review] Patch for real... sr=shaver. I like!
Attachment #221220 - Flags: superreview?(shaver) → superreview+
Comment on attachment 221220 [details] [diff] [review] Patch for real... >+pref("capability.policy.default.Selection.addSelectionListener", "UniversalXPConnect"); >+pref("capability.policy.default.Selection.removeSelectionListener", "UniversalXPConnect"); Is there a reason you didn't use "noAccess" like everywhere else? UniversalXPConnect already has a magic pass: http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/caps/src/nsScriptSecurityManager.cpp&rev=1.299&mark=2893-2896#2890 I suppose doing it this way could let you check in with an obfuscated comment like "allow signed script access" and make it look like we're expanding permission, not restricting it. r=dveditz either way though. Maybe "noAccess" on the trunk later on.
Comment on attachment 221220 [details] [diff] [review] Patch for real... The Release Team discussed this. It is a hi risk security issue that is also a red flag when it lands on the trunk or 1.8.1. We need to fix this in 184.108.40.206 now. a=timr for drivers
Attachment #221220 - Flags: approval220.127.116.11? → approval18.104.22.168+
Fixed on 1.8.0 branch. Waiting for tree opening on the other branches.
Bz - you can/should land for 1.8
Fixed on 1.8 branch too...
Flags: blocking22.214.171.124+ → blocking126.96.36.199?
Flags: blocking188.8.131.52? → blocking184.108.40.206+
verified with 220.127.116.11rc2 on Windows. all three testcases look good.
I tried the three test cases on Intel Mac 18.104.22.168rc2; no problems found.
Fixed on trunk.
Status: NEW → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.