I think this is the security check you want to use:
470 NS_IMETHODIMP
471 nsScriptSecurityManager::CheckPropertyAccess(JSContext* cx,
472 JSObject* aJSObject,
473 const char* aClassName,
474 jsval aProperty,
475 PRUint32 aAction)
aClassName and aProperty can be anything you want that uniqely identifies the resource you're protecting, and those are the strings that will become part of the ConfigPolicy pref. The values for aAction can be found in nsIXPCSecurityManager.idl. The function returns failure and sets a JS exception if the security check fails; otherwise it returns NS_OK.
-Mitch
Axel Hecht wrote:
Hi,
I'm working on http://bugzilla.mozilla.org/show_bug.cgi?id=122846 and I need to add a security check to nsIRDFResource::GetDelegate.
Not doing so would expose stuff like filters and other settings of the user to web content, once RDFResource is fully accessible.
What would be the right security check?
I was about to add a check to allow chrome and as a bonus
http://www.mozilla.org/projects/security/components/ConfigPolicy.html
for something like
user_pref("capability.policy.rdfsite.RDFResource.GetDelegate", "allAccess");
with a default of noAccess.
Two questions, does the security check like this sound reasonable, and how do I do the second check. I tried to find sample code, with little luck. GlobalWindowImpl seems to do stuff that is just a pref, and I didn't see anybody calling into checkFunctionAccess, if that'd be the right entrypoint. hrm.
Thanx for feedback
Axel
