Workloads
a proposal · permissions decided at runtime for app developers for snapd developers
Everything an app starts shares the app's permissions; workloads are a proposed way to give such programs a smaller set, and they are not in snapd at commit 13075b6544.
On the map: the workshops, south of the town hall
01 Everything the app starts shares its permissions
Confinement is per app and per hook, with security tags such as snap.photo-editor.editor. Programs an app executes from its snap inherit its AppArmor profile (ix) and seccomp filter, so they have the app's connections.
Say the photo editor runs each of its filters as a separate program, and some filters were written by other people. What may a filter do? Exactly what the editor may do. snapd gives permissions to apps and hooks, each with its own security tag, and they're fixed in snap.yaml when the snap is built. A program the editor starts from its own files inherits the editor's AppArmor profile and seccomp filter. So a filter can read your home folder and reach the network, because the editor can. There's no smaller box to put it in.
02 Workloads are a proposal
Workloads, with snapctl add-plug and attach-plug, are a proposed design (spec SD273). At snapd commit 13075b6544 there are no such snapctl commands and no workload code in the interfaces package.
Workloads are a proposed answer. A workload would be a named set of permissions inside a snap, for things the snap starts but doesn't fully trust, like those filters. In the proposal, a snap would add plugs while it runs, with snapctl add-plug, and attach them to a workload with snapctl attach-plug. You'd still decide which plugs are connected; the snap would only choose which workload gets them. None of this is in snapd at the commit this map was checked against. snapctl has no such commands, and the interfaces package has no workloads.
03 Where to go from here
Roads: per-app plugs, confinement, the container interfaces and snapctl.
Until workloads exist, the permissions you can shape are the ones in snap.yaml. The developers' deck shows how to give each app only the plugs it needs, so a helper app can have less than the editor. Confinement shows the profile a program inherits. The container interfaces, like docker-support and lxd-support, show what snaps that run containers get today: broad rights, and only with a store rule. And snapctl lists the commands a snap really has.
Read more
What exists today
| Question | Answer at snapd commit 13075b6544 |
|---|---|
| What is confined separately? | each app and each hook of a snap, by its security tag, such as snap.photo-editor.editor and snap.photo-editor.hook.configure |
| What does a program started by an app get? | the app's AppArmor profile, since the snap's own files are executed with ix (inherit), and the app's seccomp filter |
| Can a snap add plugs or slots while it runs? | no; plugs and slots come from snap.yaml, implicit system slots and hotplug |
| Can a snap connect its own plugs? | no; it can only ask with snapctl is-connected |
Is there a snapctl add-plug or attach-plug? | no |
The proposal
Workloads are described in a design specification (SD273) that is not part of the snapd tree. What the map knows of it: a workload is a named set of permissions inside a snap for programs the snap starts but does not fully trust; plugs would be added at runtime with snapctl add-plug and attached to a workload with snapctl attach-plug; connecting would stay with the user. Details may change before any of it lands.
Narrowing permissions today
- Give each app only the plugs it needs; a top-level plug listed by no app goes to all of them.
- Run untrusted code in a separate app of the snap with fewer plugs, or in a separate snap.
- Snaps that manage containers use interfaces such as
docker-supportandlxd-support, which need a store rule to install.
Further reading
- Snap confinement: what strict confinement is.
- Security policies: AppArmor, seccomp and the device cgroup per app.
- docker-support interface: the rights a container manager snap is given.
Roads from here
INTERFACES AND CONFINEMENT
- Interfaces for snap developers — per-app plugs as the way to narrow permissions today
- Confinement — the profile a started program inherits
- Interfaces — back to the interfaces overview
SNAPCTL · the snap's API into snapd
- snapctl: how it works — the commands a snap really has
INTERFACE FAMILIES · every interface, grouped by what it touches
- Interfaces: containers, VMs and support — what snaps that run containers are given today