Web powerbox interface

Update: A concrete Powerbox spec has now been posted on the public-device-apis mailing list, which partially supersedes the description on this page.

Background

We wish to provide a generic mechanism by which a user can grant one web app access to a service provided by another web app. Services are represented as web-keys (unguessable URLs), but these are not exposed to the user.

The immediate motivation is to provide a way for web apps to be granted access to local devices, such as microphones, cameras and GPS (geolocation). Others have proposed that these devices be accessed through new Javascript interfaces, built in to the web browser. We propose that these devices be accessed as local web services, through RESTful APIs, and we propose to solve the problem of granting access in the general case, so that it works for non-local resources too.

Overview

The basic model is that the browser has a list of providers of services, similar to a list of bookmarks. Each provider in the list has a name, a web-key, a list of service type names, and other metadata.

A web page can passively request a service using an <input> element (with a new type attribute value), which is rendered as a button. Clicking the button opens a dialog containing the list of providers, filtered by type. Depending on the kind of provider, selecting a provider either grants a service to the requesting page straight away (a non-interactive provider), or it opens further UI, supplied by the provider, in a new tab (this is an interactive provider).

A web page can passively offer up a service provider using a new HTML element, also rendered as a button. Clicking the button opens a dialog to add to the user's list of providers, similar to adding a bookmark.

/wiki/WebPowerbox?action=AttachFile&do=get&target=web-grant.png

Rationale

Web browsers already provide one trusted-path "powerbox" user interface for authorising access: the file upload dialog. Web Powerbox goes beyond this:

  1. it attempts to be generic by supporting an open-ended set of service types;
  2. it supports multiple service providers;
  3. it provides a way to register service providers.

a) Web Powerbox aims to be generic because:

b) Web Powerbox supports multiple providers because:

c) Web Powerbox provides a UI for registering new providers. We expect that some providers will be built-in/pre-installed -- in particular, local devices, such as camera, audio, geolocation, and maybe a local printer. But other providers cannot be pre-installed, because they are specific to the user accounts of whatever remote web services users choose to use.

We also want to provide a means for building new services out of existing services. For example, a user concerned about privacy might want a time-limited geolocation service which provides geolocation data for some period of time before expiring. A built-in geolocation service might not provide this. The user has the option of wrapping the built-in service with one that provides this revocation feature.

Powerbox: register a provider

Arguments:

UI:

Returns:

Powerbox: request a service

Arguments:

UI:

Returns: the granted service web-key

Invoking a provider

Arguments:

Returns: the granted service web-key

Invoking the powerbox

All web apps are given the ability to invoke the powerbox, to ask to register a provider or to get a service.

The interface is a DOM element (probably an <input> element for service requests). This means that the web app cannot open the dialogs asynchronously; the dialogs are only opened in response to a user click.

A powerbox request is made on behalf of a web site's identity. We want this identity to match the identity shown in the browser's trusted chrome (usually the URL bar), so that grants are recorded against an identity that the users expects, in order to help the user in reviewing and revoking grants. This means we probably want to disallow powerbox requests inside cross-origin iframes.

Revocation

Providing a facility to revoke grants is the responsibility of service providers.

Revocation is not needed for one-shot services. e.g. Once a photo has been uploaded, the receiver's possession of the data cannot be undone.

However, it is possible and desirable to revoke access to future data from geolocation, microphone, camera etc.

Some services might want to display indicators as part of the browser's trusted chrome or as icons in the system tray; for example, a "Camera is recording" indicator with a "Stop" button. This ability might be reserved to local services that are built in to the system, such as microphone and camera. Chromium extensions may be one way that web apps can be granted the ability to display icons or notifications like this. Mechanisms for doing this are outside the scope of the Web powerbox spec.

Use cases

Types of provider:

It is possible to create wrappers that attenuate a service. For example:

Virtualised services:

REST binding

The interfaces above are abstract. TODO: Define a concrete mapping onto a REST API.

Questions

Terms

What terminology should we use?

Service type names

Type names: What format should type names be?

Tab-scoping grants

How can we arrange a grant which is limited in scope to the lifetime of a tab? (i.e. The grant is revoked when the user closes the tab or destroys the DOM by navigating away, or if the machine is rebooted.) The provider could receive an object (a browser-served URL) which represents the tab's lifetime. This needs to be fail-safe.

Exposure of web-keys

When are we hiding URLs-as-caps from the user and when are we exposing them?

Exposure of petnames

If the browser provides a petname system, what happens if the user changes the petname for a site?

There are three options, depending on how far we want to go in implementing Mark Miller's proposed petname markup system:

Prototyping

We could prototype this system without changing the web browser, by implementing the powerbox itself as a local web service, perhaps one which is able to open windows on the screen. Instead of requesting/offering services/providers via a DOM element button, web apps can make powerbox requests via XHR on a powerbox web-key. This means that the provider-chooser dialog can be opened asynchronously (i.e. not in response to a user click) and interrupt the user, which is not ideal.

Each web site should be given a different powerbox web-key. How can these web-keys be set up? We could set this up manually by copying a web-key into a form on the web site, or we could use Greasemonkey (or similar) to make a web-key available through the DOM.

References

WebPowerbox (last edited 2010-06-14 05:24:20 by MarkSeaborn)