Your submission was sent successfully! Close

You have successfully unsubscribed! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates about Ubuntu and upcoming events where you can meet our team.Close

Snap-declaration assertion

The snap-declaration assertion defines several important properties of a snap, including its snap-id, the official name, the publisher. However, it’s mainly used to control what plugs or slots a snap is allowed to use, and if a snap is allowed to use a plug/slot, what other slots/plugs should connect to that plug/slot on this snap.

This assertion is downloaded with the snap when installing a snap from a store and includes details on the actions to take when performing the installation.

The snap-declaration assertions for all installed snaps can be seen by running snap known snap-declaration.

Snap-declaration assertion fields

The format is as follows:

type:               snap-declaration
authority-id:       <authority account id>
revision:           <int>
series:             <series this assertion was created for>
snap-id:            <string>
snap-name:          <string>
publisher-id:       <the owner of this snap-id space>
timestamp:          <UTC datetime>
refresh-control:    <list of snap-ids that have gated updates>
  - [snap-id1]
  - [snap-id2]
  - ...
aliases:       <optional listing of explicit aliases granted to this snap>
  -  name: [alias1]
     target: [target-command1]
  - ...
plugs:              <map from [interface] to plug side rules>
  [interface]:      <optional plug side rules for [interface]>
    allow-installation:     <true|false>
    deny-installation:      <true|false>
    allow-connection:       <true|false>
    deny-connection:        <true|false>
    allow-auto-connection:  <true|false>
    deny-auto-connection:   <true|false>
slots:              <map from [interface] to slot side rules>
  [interface]:      <optional slot side rules for [interface]>
  ...               <similar options as rule entries for plugs>
sign-key-sha3-384: <key id> # Encoded key id of signing key

<signature>                 # Encoded signature

The index is the tuple <series, snap-id>. snap-id is a key with the same format as the account ids.

This assertion gives control on several aspects of the snap behaviour to the authority:

  • refresh-control gives a list of snaps that are gated when the one specified by snap-id is installed, so they are not automatically refreshed until they are “validated”. Validation is performed by using validation asserts, which specify the revision of the gated snap that should be installed if the gating snap has been installed.

  • aliases gives a list of the explict aliases that we want to automatically enable when installing the snap. Aliases provide short names for applications contained in the snap, so we do not need to use the full command name <snap-name>.<target-command>.

  • plugs and slots define flags per interface. This lets define restrictions on how the snap plugs/slots used by the snap are handled. For instance, we can allow or deny connections with allow-connection and deny-connection. With allow-auto-connection or deny-auto-connection we let snapd know if it should automatically connect plugs/slots on snap installation.

    See Connection management (below) for more details on these restrictions, and see snap-declaration store scoping for more information on how auto-connections can be linked to a brand store.

See Assertion format for more details on fields common to most assertions.

Connection management

The overall structure of the snap-declaration has two top-level keys, plugs and slots, which affect the plugs and slots of the snap respectively. Beneath these keys are the names of interfaces, and for each interface key is an map which has 6 possible keys:

  • allow-installation
  • deny-installation
  • allow-connection
  • deny-connection
  • allow-auto-connection
  • deny-auto-connection

Each of these keys can either have a static value of true/false in the assertion or can be a more complex object/list which then is “evaluated” by snapd on a device to determine the actual value, be it true or false. If there is no such a rule in the snap-declaration for an interface plug/slot that a snap is using, then the base-declaration from inside snapd is used to populate rules, more on that below.

The deny-* variant of keys are almost never used in snap-declarations and are instead mainly used in the base-declaration inside snapd to express more complex default behaviours, for example some interfaces should auto-connect only on classic but not on Core or vice versa, and having deny-* keys makes this simpler/easier to express, but when granting snap-declarations for brand store users, allow-* keys are almost always used so this document only covers allow-* keys below.


The allow-installation key is the first key that is evaluated when the snap is being installed. If this evaluates to false, the snap cannot be installed if the interface plug or slot for which allow-installation evaluated to false exists in the snap.

allow-installation is not evaluated for interfaces which do not exist in the snap and thus do not affect installation. An example would be the snapd-control interface, which has in the base-declaration the static allow-installation: false rule for plugs:

    allow-installation: false
    deny-auto-connection: true

If a snap does not plug snapd-control then this rule does not apply, but if the snap does declare a snapd-control plug and there are no other rules for this snap about snapd-control then snap installation will fail. To allow installation of such a snap, the snap-declaration must be edited such that allow-installation evaluates to true.

Snap interfaces which have allow-installation set to false for their plugs in the base-declaration are said to be “super-privileged” meaning they cannot be used at all without a snap-declaration assertion.


The allow-connection key is the next key to be evaluated, after the snap is allowed to be installed.

This key will control whether a connection is permitted at all and usually is used to ensure that only “compatible” plugs and slots are connected to each other. A great example is the content interface, where the following (abbreviated) rule from the base-declaration is used to ensure that a candidate plug and slot content interface have matching content attribute values.

        content: $SLOT(content)

This can be read as allow-connection evaluating to true only when the plug has an attribute “content” and the value of the plug attribute is the same as the slot attribute “content” value. That is to say these plug and slots are compatible because content does not match for the plug and slot:

    interface: content
    content: specific-files

    interface: content
    content: specific-files

While the following plug and slots are not compatible:

    interface: content
    content: other-files

    interface: content
    content: specific-files


Theallow-auto-connection key is the final key to consider when snapd is considering automatic connection of interface plugs and slots.

If this key evaluates to true, then this plug/slot combination is considered a valid candidate for automatic connection. This is the most common key used when granting snap-declaration assertions since many interfaces are not super-privileged, so they do not need allow-installation set in the assertion and they also do not have any allow-connection rules in the base-declaration, so the only thing that needs to be setup is allow-auto-connection.

Example snap-declaration assertion

The following is an example snap-declaration assertion from the modem-manager snap:

type: snap-declaration
format: 1
authority-id: canonical
revision: 9
series: 16
snap-id: KtwxgRlwCAVKFw92BUdt1WloH1Va3QPo
    allow-auto-connection: true
publisher-id: canonical
    allow-connection: true
snap-name: modem-manager
timestamp: 2016-10-25T15:35:43.646671Z
sign-key-sha3-384: BWDEoaqyr25nF5SNCvEv2v7QnM9QsfCc0PBMYD_i2NGSQ32EF2d4D0hqUel3m8ul


This page was last modified 3 months ago. Help improve this document in the forum.