[Greasemonkey] Cross-script configuration data sharing
Johan Sundström
oyasumi at gmail.com
Mon Jan 9 07:52:51 EST 2006
Back again; some excerpts:
>>> Maybe scripts with the same namespace could share the same values?
>>
>> That would seem like a security issue.
>
> Indeed. Though extensions can access any data on your disk, so as long
> as users and authors understand this, I would think this does not raise the
> stakes much.
I'd go for the more cautious approach on not robbing any scripts of
their data privacy, unless they specifically opt in on it using GM_*
support methods for it, be it via my suggested additional optional
parameters to GM_setValue, or Lenny Domnitser's suggested (cleaner)
GM_exportValue method. The more literate name has particular merit for
making code easier to read and becoming more grep(1)able.
Providing slate access, if even read only, to previously private data
sounds like shooting ourselves in the foot. IMO, namespaces should not
have anything to do with security or access rights unless we add
support for signed scripts, so a namespace indeed is provably mine and
not somebody else's. Feels like severe overkill to me, though,
especially for the problem I'm trying to solve.
I particularly liked Gareth Andrew's thoughts below:
> My simple solution would be to add a (optional) namespace parameter to
> GM_Get/SetValue. Scripts could access other scripts namespace, or
> scripts could use a separate shared namespace. In my case, this
> solution seems particularly elegant since the code using the
> GM_get/setValue functions is encapsulated in a separate library (using
> GM_Imports) and it makes sense for the library to have its own
> namespace.
I didn't consider the GM_Imports aspect in my initial proposal, but it
does indeed look rather elegant. I'm not well read-up on the imports
system, though -- would those be more or less stand-alone GM scripts
(with their own @namespace, @version et al declarations, minus
@include / @exclude hooks) that other scripts list a dependency to?
(Question intentionally side-stepping user interface issues; for the
above purposes it is not relevant whether they also show up among
installed scripts or not.)
--
/ Johan Sundström, http://ecmanaut.blogspot.com/
More information about the Greasemonkey
mailing list