I have been working on several GUI based Ubuntu Core management/maintenance tools recently (as have a few other teams too (i.e. the confdb studio)).
One thing these tools have in common is that they are either using snap signor snap prepare-image in the backend to achieve their tasks.
Since there is no REST endpoint for signing (or prepare-image) in the snapd API (which would at least make strict confinement with snapd-control possible) this forces these snaps to be classically confined.
This made me itch enough to have a go at implementing an assertion-sign (the name can indeed be adjusted) interface applications like this can utilize so that the hard requirement for classic can be dropped.
This was implemented with the help of a local Qwen3.8 setup, the design document below was also drafted with it.
A PR with the proposed code changes has been filed under:
Design doc:
A built-in assertion-sign interface and POST /v2/assertions/sign daemon endpoint
Audience: snapd maintainers, security reviewers
Status: Proposal / draft for review
Areas touched: interfaces/builtin, daemon (API + access control), polkit policy, client (library), asserts/signtool (reuse), spread tests, documentation
1. Motivation and problem
Developer GUIs (assertion editors, image builders, device configuration tools) need to produce
signed assertions — the same thing snap sign does. Today the only supported way to run
snap sign from a snap is classic confinement, because snap sign reads the user’s
private signing key (GPG keyring under ~/.snap/gnupg, or an external key manager via
SNAPD_EXT_KEYMGR) and the private key material must not flow through any unmediated channel.
A classic snap, however, is not a sandbox: any code in it (including a compromised dependency or
a malicious update) can read the user’s private key file, invoke snap sign on arbitrary
input, and upload signed assertions. There is no per-invocation consent, no per-snap scoping,
and no audit trail of who signed what.
We want these tools to be restricted (confinement: strict), with signing
mediated by snapd: the app provides an assertion statement, snapd validates the request
against a connected interface + a user-authorized polkit action, and snapd performs the signing
with a key the app cannot reach directly. The private key never leaves the mediation boundary,
and every signature requires explicit user authorization.
2. Why this is feasible without new AppArmor machinery (verified against current snapd)
Three existing mechanisms compose into exactly what we need:
-
Every restricted snap already has the snapd snap socket. The base AppArmor template (
interfaces/apparmor/template.go) grants/run/snapd-snap.socket rwto all snaps (“for snapctl”). No new AppArmor rules are required. -
Caller identity on that socket is kernel-verified. The daemon’s
ucrednetListenercaptures peer credentials (SO_PEERCRED) anducrednet.resolveSecurityTag()maps the peer PID → AppArmor label (cgroup fallback) → snap instance name. Onsnapd-snap.socket,requireInterfaceApiAccessImpl()(daemon/access.go) then requires an active connection from that snap to a named interface before the request is considered. Headers such as the app’s self-declared name are not trusted for this decision. -
Daemon APIs are already gated by interface + polkit.
interfaceRootAccess{Interfaces, Polkit}exists and is used today (e.g. FDE endpoints inapi_system_volumes.gouse per-action polkit viabyActionAccess). The code comments explicitly require the polkit action to beauth_adminfor interface-gated access — exactly the consent semantics we want. Seclog audit events (grant/deny, with interface + side) are recorded automatically.
What does not exist today:
- no
/v2/assertions/sign(or any signing) endpoint indaemon/— signing is done locally by thesnapCLI (cmd/snapd/cli/cmd_sign.go→asserts/signtool.Sign); - no
signaction inio.snapcraft.snapd.policy; client/has no sign API (nothing beyond assert find/import).
So the feature is: one new builtin interface + one new endpoint reusing signtool.Sign + one
new polkit action + client helpers. The authorization plumbing is reused as-is.
3. Overview
┌────────────────────────────┐ ┌──────────────────────────────────────────────┐
│ GUI snap (restricted) │ │ snapd daemon (root) │
│ - builds statement JSON │ HTTP │ 1. ucred → security tag → instance name │
│ - POST /v2/assertions/sign│───────▶│ 2. active connection to `assertion-sign`? │
│ - X-Allow-Interaction │ │ 3. polkit io.snapcraft.snapd.sign │
│ │ │ (auth_admin; prompt via the caller's │
│ (polkit prompt appears on │ │ desktop session's agent) │
│ the user's session, │ │ 4. type allow-list (connection attrs) │
│ rendered by the agent — │ │ 5. signtool.Sign(statement, keypairMgr) │
│ NOT by the snap) │ │ keypairMgr = ExternalKeypairManager │
└────────────────────────────┘ │ ┌─────────────────────────────────┐│
└───────────┤ key-manager snap (separate) ││
unix└─────────────────────────────────┘│
socket (root) holds private keys / HSM│
Key property: the signing GUI snap holds no key material and no key access. Its only path
to a signature is socket → snapd → (polkit consent) → the key source (the system GPG
keyring by default, or a separate key-manager snap/HSM if the deployment opts in, K3). The
app is a passive subject at every hop: it opens the socket, sets the interaction header, and
waits; it can neither read the key nor skip the consent.
Important clarification on polkit: a restricted snap cannot invoke polkit itself, and does
not need to. It only opens the daemon socket (already granted by the base template) and sets
the X-Allow-Interaction: true header. The daemon (root) is the process that calls
org.freedesktop.PolicyKit1.Authority.CheckAuthorization on the system D-Bus, using the snap’s
peer PID/UID/start-time (from SO_PEERCRED) as the polkit subject (polkit/authority.go).
polkitd then maps that subject to the user’s desktop session and asks that session’s polkit
agent for the decision. This is exactly how the existing io.snapcraft.snapd.manage /
manage-fde actions already work, and how a restricted snap such as snap-store triggers its
“Authentication is required to install, update, or remove packages” prompt today. Consequences:
- The app must send
X-Allow-Interaction: true, else the request fails with 401 (ErrInteraction→ not authorized, no prompt). The officialclientlibrary does this automatically whenclient.interactiveis set (client/client.go). - A desktop session with a polkit agent must exist to render the prompt; headless/SSH-only systems will deny. (Deployment property, same as existing manage actions.)
- The action default is
auth_admin(mandatory for interface-gated access peraccess.go), so the consenting user must be an admin user. A non-sudo desktop user can never sign. - A root caller (uid 0) is granted without any polkit interaction (
access.goshort-circuit).
4. The interface: assertion-sign
Modeled on snapd-control / ros-snapd-support (both allow-installation: false,
deny-auto-connection: true).
// interfaces/builtin/assertion_sign.go (new)
const assertionSignSummary = `allows signing assertions mediated by snapd`
const assertionSignBaseDeclarationPlugs = `
assertion-sign:
allow-installation: false
deny-auto-connection: true
`
const assertionSignBaseDeclarationSlots = `
assertion-sign:
allow-installation:
slot-snap-type:
- core
deny-auto-connection: true
`
// No connectedPlugAppArmor needed: the snap socket is already granted to all
// restricted snaps by the base AppArmor template, and the daemon gates API
// access by the connection itself (ucred + connection state).
type assertionSignInterface struct {
commonInterface
}
// Validate plug attributes at connection time (fail fast, not at signing time).
func (i *assertionSignInterface) BeforePreparePlug(plug *snap.PlugInfo) error {
types, ok := plug.Attrs["assertion-types"]
if !ok {
return nil
}
for _, t := range types.([]any) {
s, ok := t.(string)
if !ok || asserts.Type(s) == nil {
return fmt.Errorf("unknown assertion type %v in plug attribute \"assertion-types\"", t)
}
}
return nil
}
func init() {
registerIface(&assertionSignInterface{commonInterface{
name: "assertion-sign",
summary: assertionSignSummary,
implicitOnCore: false,
implicitOnClassic: false,
baseDeclarationPlugs: assertionSignBaseDeclarationPlugs,
baseDeclarationSlots: assertionSignBaseDeclarationSlots,
}})
}
Plug attributes (evaluated by snapd at connect time, immutable while connected):
| Attribute | Type | Meaning |
|---|---|---|
assertion-types |
list of strings, required | Allow-list of assertion types this connection may sign. Omitted or empty = deny-all: the plug is rejected at install time and the endpoint treats such a connection as unable to sign. The requested scope is declared alongside the allow-installation request for the plug. |
update-timestamp |
bool | Permit the endpoint’s update-timestamp flag (default false). |
Note: the security tag resolves to the snap instance name, so parallel instances are distinguished automatically; no interface work is needed there.
5. The endpoint
5.1 POST /v2/assertions/sign
// request
{
"key": "default", // key name (or "default"); resolved to key id by the key manager
"statement": { "type": "snap-declaration", "account-id": "…", "snap-id": "…", … },
"chain": false, // also return account-key + account assertions
"update-timestamp": false
}
// response 200
{ "type": "sync",
"result": "snap-declaration 1 …\n\nbody\n\nopenpgp rsa …\n" } // UTF-8 assertion text
Handler sketch (access wiring follows the existing Command pattern, cf. appsCmd in
daemon/api_apps.go; the interface + polkit gate is evaluated in daemon/access.go before the
handler runs):
// daemon/api_sign.go (new)
const polkitActionSign = "io.snapcraft.snapd.sign" // in daemon/api.go, next to polkitActionManage
var signAssertCmd = &Command{
Path: "/v2/assertions/sign",
POST: signAssert,
WriteAccess: interfaceRootAccess{Interfaces: []string{"assertion-sign"}, Polkit: polkitActionSign},
}
var listKeysCmd = &Command{
Path: "/v2/keys",
GET: listKeys,
ReadAccess: interfaceOpenAccess{Interfaces: []string{"assertion-sign"}},
}
func signAssert(c *Command, r *http.Request, _ *auth.UserState) Response {
// caller identity + connection already enforced by the access checker;
// re-derive instance name only to scope the per-connection allow-list
ucred, err := ucrednetGet(r.Context())
if err != nil {
return InternalError("cannot identify caller: %v", err)
}
instanceName, err := ucred.InstanceName()
if err != nil {
return InternalError("cannot determine caller snap instance: %v", err)
}
var req struct {
Key string `json:"key"`
Statement map[string]any `json:"statement"`
Chain bool `json:"chain"`
UpdateTimestamp bool `json:"update-timestamp"`
}
if r.ContentLength > maxSignBody {
return BadRequest("request body too large")
}
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
return BadRequest("cannot decode request body: %v", err)
}
if req.Statement == nil {
return BadRequest(`missing "statement"`)
}
keyName := req.Key
if keyName == "" {
keyName = "default"
}
// 1. type allow-list from the connection's static plug attrs (see §4)
allowed, err := connectedPlugAssertionTypes(c, instanceName)
if err != nil {
return InternalError("%v", err)
}
if !allowed.all {
typ, _ := req.Statement["type"].(string)
if !allowed.contains(typ) {
return Forbidden("assertion type %q is not allowed for this connection", typ)
}
}
// 2. key manager: daemon-configured (GPG keyring or SNAPD_EXT_KEYMGR) — see §7
kpm, err := signKeypairManager()
if err != nil {
return InternalError("cannot open keypair manager: %v", err)
}
privKey, err := kpm.GetByName(keyName)
if err != nil {
return BadRequest("cannot use %q key: %v", keyName, err)
}
stmt, _ := json.Marshal(req.Statement)
opts := &signtool.Options{
KeyID: privKey.PublicKey().ID(),
Statement: stmt,
UpdateTimestamp: req.UpdateTimestamp,
}
encoded, err := signtool.Sign(opts, kpm)
if err != nil {
return BadRequest("cannot sign assertion: %v", err)
}
// 3. encode (identical bytes to `snap sign` output), mirroring cmd_sign.go
var buf bytes.Buffer
enc := asserts.NewEncoder(&buf)
if err := enc.WriteEncoded(encoded); err != nil {
return InternalError("cannot encode signed assertion: %v", err)
}
if req.Chain {
// fetch account-key (public-key-sha3-384 = key id) + account, then
// enc.Encode(accountKey); enc.Encode(account) — as cmd_sign.go does
}
return SyncResponse(buf.String())
}
Design notes:
statementis a JSON object (headers + optional"body"string), matchingsnap signstdin format 1:1, so existing tools can adapt trivially.signtool.Signreturns the signed assertion text (UTF-8), identical tosnap signoutput — no format drift.chainis better in the daemon than in the CLI: the daemon already has store access to fetchaccount-key/account(the CLI fetches them on its own).- A request size cap applies (statements are small; cap anyway, e.g. 1 MiB).
5.2 GET /v2/keys (read-only)
// response 200
{ "type": "sync", "result": [
{ "name": "default", "sha3-384": "abc…" } ] }
Gated on the same interface via interfaceOpenAccess (connected plugs only — it exposes only
public key ids, same as snap keys does today). Lets a GUI list selectable keys. Key generation, deletion and export are not
exposed through the daemon: they live on the key-manager snap’s own socket (see §8).
5.3 client library
client/sign.go:
func (client *Client) Sign(key string, statement map[string]any, opts *SignOptions) (string, error)
with SignOptions{Chain, UpdateTimestamp}.
which POSTs over the snap socket using the caller’s snap identity (the CLI already does this
for other endpoints; the app name is derived from $SNAP_INSTANCE_NAME inside a snap, as with
snapctl). The client must be created interactive (or set X-Allow-Interaction: true) so the
polkit prompt can appear — see §3. Provide ErrNotSupported (404) so apps can detect
pre-feature snapd and fall back to an “external sign required” UI.
6. Authorization flow (end to end)
- App connects to
snapd-snap.socket(already allowed by the base template). - Daemon: peer PID → AppArmor label → instance name; looks up active connection where that
instance is the plug of
assertion-sign. No connection → 403. - Access level: root-equivalent → uid 0 grants immediately (no polkit); otherwise polkit check
io.snapcraft.snapd.signagainst the app’s real user, withX-Allow-Interaction: true→ polkitd asks the user’s session agent for anauth_admindecision → the agent renders the consent prompt on the user’s desktop (the app is a passive subject; it never touches polkit). - Prompt shows: calling app name, assertion type, account-id, key name, and (nice-to-have) a statement digest/summary (see threat T8).
- Grant → seclog audit event (
granted, polkit, assertion-sign/plug); Deny → 401 + audit event. Dismiss → 401auth-cancelled+ audit event.
7. Threat model
7.1 Assets
- Private signing key material (and ability to invoke signing) — the crown jewel; a leaked or abused key yields valid developer-identity assertions.
- Consent integrity — the user’s “yes” must bind to the exact assertion signed.
- Assertion integrity/confidentiality of the flow — statements may contain account data.
- snapd daemon — compromise of the daemon must not by itself yield signatures.
7.2 Trust boundaries
| # | Boundary | Enforced by |
|---|---|---|
| B1 | app ↔ daemon (socket) | kernel socket peer creds + AppArmor label/cgroup → instance name; active connection state |
| B2 | daemon ↔ policy | polkit io.snapcraft.snapd.sign = auth_admin (user consent), decided by the user session’s agent via polkitd |
| B3 | daemon ↔ key source | K1 (default): the daemon’s own process reads the system GPG keyring (~/.snap/gnupg, root) — the same boundary snapd has today. K3: the daemon talks to an external SNAPD_EXT_KEYMGR backend over a root-only socket owned by a separate confined snap |
| B4 | key source ↔ keys/HSM (K3) | key-manager snap’s own confinement; key files 0600 root in its private state (or HSM-backed) |
| B5 | prompt ↔ signed bytes | polkit details (type, account-id, key, digest) must be computed from the same statement the daemon signs |
7.3 Actors
- U — legitimate user running the GUI (unprivileged).
- A — the (honest) GUI snap.
- M — malicious or compromised snap (any other restricted snap, or A with a malicious update/dependency), unprivileged.
- D — compromised snapd daemon (root).
- R — root on the host (out of scope; root can read anything by definition).
7.4 Threats, mitigations, residual risk
| ID | Threat | Mitigation in this design | Residual |
|---|---|---|---|
| T1 | U (unprivileged) reads private keys | The key lives in the daemon’s key source (K1: the system GPG keyring; K3: a separate snap’s private state). The confined GUI snap (A) has no path to it — no keyring access, no socket to any key manager. (On K1, the user can still read their own key via gpg, exactly as today; the app cannot.) | none beyond R |
| T2 | M signs with U’s identity | M must (a) have assertion-sign connected (explicit, admin-visible, non-auto, store-blocked) and (b) pass the auth_admin polkit prompt per signing. Prompt shows M’s app name. M cannot bypass polkit by running as root: restricted snaps run as the user |
A prompt-fatigued user; see T8 |
| T3 | M signs arbitrary assertion types | The assertion-types allow-list (required) is checked in the handler before signtool.Sign (before any prompt); an omitted or empty allow-list is deny-all, and such a plug is rejected at install time |
Admin must declare the allowed types on the plug; the endpoint is fail-closed |
| T4 | D (compromised snapd) signs | Default (K1): a compromised daemon can sign — it holds the keyring. This is the same key-trust posture snapd has today (a root daemon can always read ~/.snap/gnupg); the per-sign auth_admin consent does not protect against a daemon that is already subverted. K3 (opt-in): the key lives in a separate confined snap or HSM the daemon cannot read, so a compromised daemon cannot sign on its own |
K1: daemon compromise yields signatures (status quo). K3: none |
| T5 | D (or A) learns key material | The endpoint exposes no key export to callers; GET /v2/keys exposes only names + public sha3-384. (With K3 the backend is additionally sign-by-handle only, and HSM-backed keys reduce even the key-store risk to theft-of-service.) |
none beyond R on K1; HSM reduces B4 on K3 |
| T6 | Prompt injection / misleading consent | polkit details populated from the same statement bytes that get signed: type, account-id, key name, sha3-256 of statement (B5). GUI should also display it | polkit agent rendering fidelity |
| T7 | Replay of an old signature | Signatures are inherently replayable (that’s what assertions are); update-timestamp gated by connection attr; no new risk vs snap sign today |
none |
| T8 | User signs under duress/fatigue (prompt bombing) | Each signing requires a fresh auth_admin decision; agent supports auth_admin_keep if admins later prefer a keep-alive; seclog records every grant/deny for forensics |
acceptable; same class as all polkit-gated ops |
| T9 | Malicious statement content (bodies) | Size-capped; statement is opaque JSON to the daemon — the daemon does not interpret or execute it; validation is the assertion schema inside signtool.Sign |
none |
| T10 | (K3) Key-manager snap compromise | It is the key holder; keep it minimal (no GUI by default — a GUI is a separate snap that uses its socket), small attack surface, HSM option | equals the current risk of any key store |
| T11 | A bypasses the socket (e.g. bundles gpg + keyring in its own writable state) | A is restricted: it can bundle gpg, but it has no key material and no access to the managed keyring, so anything it signs is worthless (not signed with the real key). Classic confinement is what makes the old “bundle everything” approach work — the restricted app holds no real key | none |
Threat-model summary: the design separates the statement (the app) and the consent
(user via polkit, rendered by the user’s own session agent) from the key (a key source the
app cannot reach — the system GPG keyring by default, or a separate key-manager snap/HSM if
the deployment opts in, K3). The app can never complete a signature on its own: it can only
request one, and each request needs a connected assertion-sign plug and a fresh
auth_admin consent. (With the default K1 source a compromised daemon can still sign —
the same as today; K3 is the opt-in that also isolates the key from the daemon.) The classic
model instead gives one component (the classic snap) the statement, no consent, and the key,
all at once.
8. Where the signing key comes from
The endpoint does not care where the key lives. It signs through
signtool.GetKeypairManager(), which already resolves to an external keypair manager when
SNAPD_EXT_KEYMGR is set on the daemon and otherwise to the system GPG keyring
(~/.snap/gnupg). The FR therefore adds no new key management to snapd and no new
component for the snapd team to maintain. The choice below is which of those existing
mechanisms a given deployment uses; the default is the one everybody already has.
K1 — System GPG keyring (default)
The daemon signs from the same GPG keyring that snap sign uses today
(asserts.GPGKeypairManager against ~/.snap/gnupg). This is the default and only
built-in key source for this FR, because:
- it is the established process — the same
snap create-key/snap keys/ pinentry workflow already used by snapcraft and thousands of CI setups; nothing to learn; - it adds no new component and no new security-critical code to the snapd tree, so there is nothing extra for the snapd maintainers to own;
- it works out of the box on classic/deb snapd, where gpg is on PATH.
Honest trade-offs (vs. K3):
- the key is user-readable, and a compromised daemon can sign with it (daemon-held
keyring) — i.e. the same key-trust posture snapd already has today, not a new one. What
this FR adds is the per-sign
auth_adminconsent, per-connection scoping, and an audit trail, not a change to who can reach the key; - headless/CI signing needs a passphrase-less key or a reachable gpg-agent — the same
constraint
snap signhas today.
K2 — SNAPD_EXT_KEYMGR shipped inside the snapd package
The snapd package itself would carry the key material (e.g. under /var/lib/snapd,
root-only) and run the SNAPD_EXT_KEYMGR backend. This removes the user-readable keyring,
but it makes key policy and key material a snapd-release concern (HSM hooks, lifecycle
and key changes all ride on snapd releases) and hands the snapd team extra
security-critical code to maintain. Not proposed — shipping a key manager inside the
snapd snap is expected to be rejected on maintenance grounds.
K3 — Separate key-manager snap (optional hardening; out of this FR’s scope)
For deployments that want the key out of snapd’s reach — an HSM / TPM2 / cloud KMS, or
the guarantee that a compromised daemon cannot sign on its own — the daemon can point
SNAPD_EXT_KEYMGR at a separate, confined key-manager snap running an
SNAPD_EXT_KEYMGR backend (keys in its private state, or HSM-backed), with key lifecycle
generate/import/delete/passphrase on the key-manager’s own socket. This is a separate
component to be built and maintained outside snapd (by a vendor or the developer), not
part of this FR. The endpoint already supports it with zero snapd changes
(signtool.GetKeypairManager honors the env var), so opting in is a deployment choice.
K3 also removes the dependency on gpg entirely, which is the only way to run this feature
on the snapd snap (strict, no gpg) — on classic/deb snapd, K1 is the default.
Default posture. With K1 this feature gives a restricted snap the same signing capability a classic snap has today (one key, usable by the daemon) plus per-sign consent, per-connection scoping, and an audit trail. K3 is the opt-in upgrade for teams that also want the key isolated from the daemon.
Key-source and endpoint notes
- Key lifecycle (default K1): unchanged — it is exactly the existing
snap keys/snap create-key/ gpg workflow. For K3 it moves to the key-manager snap’s own socket; either way it is not a new snapd endpoint (snapd stays sign-only + the read-onlyGET /v2/keyslist). keyparameter: the endpoint’skeyfield is the key name (“default” if omitted), resolved to a key id by the keypair manager — same assnap sign -k. Key names map 1:1 to accounts today. A per-connection restriction on which keys (attributekeys: […]) is not in v1.- External manager format (K3): RSA-PKCS (matches
ExtKeypairMgrSigningRSAPKCSand current assertion signing); OpenPGP only if GPG-keyring interop is a hard requirement (none identified). - Configuring an external manager (K3): systemd unit drop-in or
snap set system, to be settled with upstream; recommend system-config so it is visible/auditable. No snapd code depends on the choice —signtool.GetKeypairManagerreads the daemon’s environment. - HSM/token (K3): which
ExtKeypairMgrBackendis blessed for production (PKCS#11? TPM2? cloud KMS?) is out of scope for the endpoint but defines what a key manager can be; an HSM- or non-passphrase-backed manager also removes the per-sign key-unlock prompt entirely.
9. Compatibility, rollout, and migration
- Additive: new interface (non-implicit, store-blocked by default), new endpoints, new polkit
action. No behavior change for existing snaps or for
snap signCLI. - Feature detection:
POST /v2/assertions/sign→ 404 on older snapd;client.SignreturnsErrNotSupported; GUIs keep the classic/CLI fallback path until then. - polkit policy ships in the snapd package’s
io.snapcraft.snapd.policy; distros pick it up via the same tree. - Docs: new builtin interface page; “Signing assertions from confined apps” guide; update
snap signdocs to mention the mediated path. - Migration story: GUI snaps switch from classic to
confinement: strict+plugs: [assertion-sign]once the interface lands (the default GPG keyring source needs no extra deployment; an external key manager is optional); no app code changes beyond callingclient.Sign(interactive) instead of shelling out tosnap sign.
10. Implementation plan (rough sizing)
| Piece | Files | Effort |
|---|---|---|
Interface assertion-sign + attr validation + tests |
interfaces/builtin/assertion_sign{,_test}.go |
S |
Endpoint POST /v2/assertions/sign + GET /v2/keys + tests |
daemon/api_sign{,_test}.go, daemon/api.go (const + registration), daemon/export_test.go (keypair mock) |
M |
| polkit action | io.snapcraft.snapd.policy (+ packaging), daemon/api.go const |
S |
| client helpers + tests | client/sign.go |
S |
| (optional) K3 key-manager snap + backend socket | separate component, outside the snapd tree | M (out of this FR) |
| spread tests | connection-gated 403; polkit deny 401; polkit allow 200; type allow-list 403; parallel-instance isolation; chain output parity with snap sign |
M |
| Docs | interfaces page + guide | S |
Test matrix highlights (spread):
- same app, no connection → 403; other app with connection → still 403 for the first (tag isolation);
- connection + polkit deny → 401 + seclog
denied; allow → 200 + signed output byte-identical tosnap signfor the same statement/key; assertion-typesattr violation → 403 before any polkit prompt (prompt budget preserved);chain: trueoutput validates with theassertsparser and includes account-key + account.
11. Why not just stay classic (recap for reviewers)
| Property | Classic today | Restricted + this feature |
|---|---|---|
| Private key exposure | App + all its deps can read keys | Only the key source (system GPG keyring by default, or a separate key-manager snap/HSM); the app never touches it |
| Per-signature consent | None | Polkit auth_admin prompt, every signature (rendered by the user’s session agent; the app never touches polkit) |
| Scope of signing | Anything, any type | Connection allow-list (assertion types) |
| Audit | None (local gpg) | seclog grant/deny per request, app identity |
| Compromise of app | Full identity abuse | No key access; can only request signatures (consent-gated) |
| Compromise of snapd | n/a | Same key-trust posture as today (K1) — the consent does not stop an already-compromised daemon; optional K3 isolates the key from snapd |
| User setup | gpg keyring | None extra for the default (existing gpg keyring); an external key-manager snap only if opted in (K3) |
| Works on Core / snap-based snapd | n/a (classic can’t run on Core) | Only via an external key manager (K3) — the snapd snap has no gpg at all, so K1 is unavailable there |