SDK: Application Data Folders

Registered by Christian Dywan on 2013-07-31

Applications running under confinement don't have access to $HOME or $XDG_ locations freely as on the classic desktop. Most locations are ready-only or mediated by a service.

Whiteboard

Use cases:
    U1Db. Databases belong into "share".
    Proposed solution: default relative paths to the right location.

    C++ QML plugin code. May need either "share" or "cache".
    Needs API functions to access files.

    QtWebKit
    When WebKit is used, files are automatically written to "share".

    localStorage
    Using localStorage API may use "share" and "cache" (currently /var/tmp/).

    Standard Qt5 API that works on the desktop today:
    QStandardPaths::writableLocation(QStandardPaths::DataLocation)

    Translations
    On the desktop gettext reads .mo files containing translations from /usr/share/locale. On click packages it might make sense to read them from /opt/click.ubuntu.com/*$APP_PATH*/locale

Questions:
    Which locations can we support with and without confinement?
    ~/.local/share/$APP_ID
    ~/.cache/$APP_ID
    The $APP_ID used here is a placeholder that preferrably isn't exposed in API.

    Do pure QML apps need access to absolute locations?
    Unlikely. By design most QML API doesn't expose raw file access.

    What about Firefox, LibreOffice and friends?
    It's not clear if they will run under confinement - if they do, this only affects where internal data is stored, none of the GUI facing locations. That needs to be sorted separately.

Should XDG variables be overridden to enforce confined paths?
    This should be seen as a last resort and preferrably avoided. Applications can be run in different ways and under different environments ie. Unity, KDE, Elementary etc and even if variables could be overriden per application it would result in complicated paths.

Resources:
    https://wiki.ubuntu.com/SecurityTeam/Specifications/ApplicationConfinement#Application_environment
    https://bugreports.qt-project.org/browse/QTBUG-16549

(?)

Work Items

Work items for ubuntu-13.10:
[kalikiana] Collect use cases for app data storage: DONE
[kalikiana] Ensure U1Db-Qt uses a sensible storage folder: DONE
[kalikiana] Implement app-specific environment variables in confinement: DONE

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.