Intro

This is a page to discuss the mechanisms needed to allow a contained app to request access to a file on the user's system in a safe way.

There are three pieces need:

  1. In-container library that the app links to and uses.
  2. Out-of-container daemon that apparmor allows the contained app to talk to. This daemon only validates the request and passes it on to a more trusting daemon.
  3. Out-of-container trusting daemon that actually presents the dialog and passes back the data.

Consider an image editing program like Photoshop. It might want to do things like:

  1. Allow the user to open an image in their $HOME. (prompt, read data)
  2. Allow the user to export that image as a separate format in $HOME. (prompt, write data, creating/replacing any existing file at the chosen location)
  3. Allow the user to save back changes to that image. (prompt, read data, later and periodically write data back)

In-Container Library API

API in Vala:

PrompterFile
{
  enum Mode {FILE, FOLDER};
  string title {get; set;}
  string action {get; set;}
  Mode mode {get; set;}
  bool allow_new {get; set;}
  void add_filter_pattern(string pattern);

  PromptFile(string? title, string? action);
  async GFile prompt(Cancellable? cancel) throws Error;
  async GList<GFile> prompt_multiple(Cancellable? cancel) throws Error;
}

Out-Of-Container DBus API

DBus Name: com.canonical.Prompter
Path: /Files
Interface: com.canonical.Prompter.File
 Prompt({key: value})
 Read(uri)
 Replace(uri)

mterry/Containment (last edited 2012-12-05 19:13:12 by c-66-30-117-196)