Hi, All. I have some ideas (and some experimental working code) may be
helpful to safely access sensitive resources in web apps. It bases on
some work which I talked with Jonas Sicking personally last year.
Sorry for my not posting this here earlier (and not posting correctly
nine days ago).
# Problems
To make web apps as powerful as native ones, allowing them to access a
lot of resources is required. Many of those resources are
security-sensitive or privacy-sensitive. Exposing them to random apps
will leads to great crises.
There are some classical solutions to this situation. But:
* Forcing apps to be reviewed is quit expensive.
* Forcing users to (or trust others to) grant apps privileges before
using is like engagement-before-dating.
* If a apps requires multiple sensitive resources, asking for
permission before calling is too annoying.
# Basic Idea
The core of the idea is making all sensitive objects inaccessible
unless booked first.
Whenever a web site/app wants to use some sensitive resources (e.g,
must-have WebTelephony API and optional WebSMS API), it books them
first:
var [reservedTelApi, reservedSmsApi] = navigator.conductor.book(
{
//An URI to indicate what resource to book
protocol:'
https://wiki.mozilla.org/WebAPI/WebTelephony',
},
{
protocol:'
https://wiki.mozilla.org/WebAPI/WebSMS',
//A boolean to indicate whether this resource is required,
default to false
optional:true
}
);
When the book method is called, the use agent show a modal dialog-like
interface (Jonas suggested a asynchronous version, but the right
interface and behavior are a little hard to decide) which list all
demands (and their risk) together to ask for confirmation. If many
resources can fit in a demand (e.g, while booking WebTelephony API on
a dual SIM phone), the user also could select which resource to use
here.
If the user agent thinks all demands are capable and acceptable and
unambiguous (how to tell those if out of scope), it could book the
resources automatically without showing any interface.
If a site/app books all useful resources in the beginning, this
mechanism works like the engagement-before-dating way; If it always
book a resource just before using, the asking-before-calling way.
If all required resource are booked successfully (capable to the
system and accepted by the user), the book method returns an array of
reserve objects (for optional demands not accepted, an 'undefined'
value). Otherwise, an array of 'undefined'.
The site/app calls the take methods of the reserve objects (with an
optional dictionary to pass options), to get the real resource.
var telApi = reservedTelApi.take();
var smsApi = reservedSmsApi.take();
The following steps are just like the current way.
# Benefits
* Users can test-drive sites/apps more easily. Especially when only
part of the site/app requires sensitive resources.
* Since users can confirm many demands with just one click,
confirmations is no longer too annoying.
* For the site/app could not tell a failed demand is incapable or not
accepted, silent finger-printing is not possible via this.
* This can be a formal way to introduce new APIs.
# Demos
I've built an extension for Firefox (Windows/Linux version only) to
test this idea which is available at:
https://addons.mozilla.org/en-US/firefox/addon/conductory/
Currently, only a low-level microphone API, a low-level camera API and
GeoLocation API is supported.
Some demos can be found at:
http://devtaste.com/extras/conductor/demos/
--
SUN Haitao
sunh...@devtaste.com
http://www.devtaste.com