firefox addon - Is it possible to allow a content function to run in browser scope? -
is possible (how) addon allow specific function in document/page/content scope run in browser scope?
(i aware of security implications , specific , specific purpose.)
as general example, xmlhttprequest
in content script has content scope. gm_xmlhttprequest
via greasemonkey has browser scope.
imagine having gm_xmlhttprequest
in content script , wanting addon allow gm_xmlhttprequest
run in browser scope.
there 3 separate security scopes (called principals) involved when scripting page.
- the system principal (full access everything, including operating system apis)
- the expanded principal of sandbox may scoped 1 or more origin domains. when scoped single domain it's still considered more privileged content itself
- the content principal of page itself
so if want run addon-script performs cross-origin xhr you not need grant privilege page content itself.
you need grant sandbox in addon-script runs, separated xray-wrappers untrusted page-content.
if you're using addon sdk , xhr domains finite set can specify them in addon configuration.
if need xhrs arbitrary domains have drop lower level , use frame scripts, have system principal privileges while being able manipulate page content.
for security reasons might better use framescript instantiate sandbox principal scoped page , inject privileged xhr function it, what greasemonkey does. or if needs xhr more limited might processing outside sandbox , supply function returns processed result sandbox.
Comments
Post a Comment