218 Commits

Author SHA1 Message Date
Miguel Pires
cfcc50a1cf asserts: allow $PLUG_PUBLISHER_ID in plug attribute constraints
Allow plugs to specify the $PLUG_PUBLISHER_ID in attribute constraints
such that interfaces can restrict auto-connection to when certain
attributes match their publisher IDs.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2024-06-21 15:49:09 +02:00
Miguel Pires
8128ed20bb many: rename aspect/bundle to view/registry
This changes the naming of the aspects feature to be "registry" instead
of bundle (i.e., a configuration space backed with its own storage) and
"view" instead of aspect. Once this lands, anyone that has this enabled
needs to unset the experimental flag and rename the state entry before
refreshing snapd and then re-enable.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2024-06-17 17:16:57 +02:00
Miguel Pires
562fe027c8 asserts: move aspect schema to assertion body (#13666)
* asserts: move aspect schema to assertion body

Move the aspect schema from a "storage" stanza to the assertion body.
Also format parse and re-encode the JSON with two spaces for indentation
and map ordered map keys. This should make the schema uniform and easy
to read while still using a format that can be emulated by other tools.

* many: nest schema in storage stanza

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>

* asserts: support checking JSON body format

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>

* asserts: improve err messages; move check

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>

---------

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2024-03-13 17:22:05 +02:00
Samuele Pedroni
3c93806071 asserts: define new aspect-bundle assertion (#13545)
this holds configuration aspects' defintions

* asserts: some doc comment fixes and tweaks

thanks @MiguelPires
2024-02-07 10:16:09 +01:00
Samuele Pedroni
8203f7111d asserts: implement snap-resource-pair 2024-01-02 16:35:08 +01:00
Samuele Pedroni
3ce86db9ee asserts: implement snap-resource-revision
including delegation support parallel to snap-revision similar support
2023-12-13 22:10:24 +01:00
Samuele Pedroni
6cc7429752 asserts: add support for account-key constraints (#12988)
and take them into account when verifying assertion signatures
2023-08-08 15:43:19 +02:00
Miguel Pires
d097436c1c many: fix formatting w/ gofmt 1.19
Go 1.19 includes some changes to gofmt which intend to make lists and
heading clearer when rendered (https://go.dev/doc/go1.19). This commit
is the result of running the new gofmt and manually fixing some of it.
This was necessary because the new gofmt assumed lines beginning w/ tabs
to start lists or examples. While this is often true in our codebase,
we occasionally also use tabs to indent the lines after a TODO or FIXME
prefix or in yaml (e.g., excerpts of a snap.yaml). This meant that a lot of the
reformatted comments were broken and had to be fixed manually.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2023-01-16 14:23:11 +01:00
Philip Meulengracht
99302b1ad3 asserts: review feedback
update maxSupportedFormat to 2, update test, add check that UserExpiration is empty by default
2022-10-19 10:38:34 +02:00
Samuele Pedroni
920389ac46 asserts,cmd/snap-repair: drop not pursued AuthorityDelegation/signatory-id code
in the end we went for a control assertion (snap-declaration) specific
delegation approach, instead of the generic one
2022-08-24 14:04:35 +02:00
Samuele Pedroni
314b359bb3 asserts,snap: expose provenance on snap.Info and validate it
also introduce naming.ValidateProvenance,ValidProvenance and
a DefaultProvenance constant
2022-07-17 18:09:14 +02:00
Samuele Pedroni
44533f9cb6 many: introduce optional primary key provenance for snap-revision 2022-06-24 10:21:07 +02:00
Samuele Pedroni
bee5d6bcaf asserts: simplify some of the optional primary keys with default code 2022-04-21 17:11:33 +02:00
Samuele Pedroni
e1bb531595 asserts,store: relax reportFetchAssertionsError logic
use a new AssertionType.AcceptablePrimaryKey to check whether a key
has enough entries allowing for the omission of optional primary key
headers
2022-04-06 14:17:12 +02:00
Samuele Pedroni
491ff56795 asserts: export MockOptionalPrimaryKey for usage in other packages 2022-04-06 14:17:12 +02:00
Samuele Pedroni
a5d271b8f7 asserts: Ref supports for optional primary key headers
including being built with a PrimaryKey omitting default values

introduce ReducePrimaryKey to omit default values, useful also when
dealing with systems that might not support given optional primary
keys yet
2022-04-06 14:17:12 +02:00
Samuele Pedroni
c885693492 asserts: support in HeadersFromPrimaryKey for omitted optional primary keys 2022-04-06 14:17:12 +02:00
Samuele Pedroni
98de63ac23 asserts: support optional primary keys in Find family
change PrimaryKeyFromHeaders to allow for omitted optional primary
keys
2022-04-06 14:17:12 +02:00
Samuele Pedroni
67ad4bcb85 asserts: clarify and simplify around optional primary key headers
clarify optional primary key headers and defaults, thanks @bboozzoo

simplify AssertionType.validate, thanks @stolowski
2022-04-05 10:04:48 +02:00
Samuele Pedroni
bf45d31d59 Merge remote-tracking branch 'upstream/master' into asserts-opt-primary-keys-1
fix conflict
2022-04-05 09:56:54 +02:00
Michael Vogt
53e100759f Merge pull request #11502 from pedronis/disable-authority-delegation
asserts: minimal changes to disable authority-delegation before full revert
2022-03-15 15:00:00 +01:00
Samuele Pedroni
331724d76d asserts: minimal changes to disable authority-delegation before full revert
authority-delegation might have been premature, disable until we might
decide for a full revert
2022-03-14 18:47:04 +01:00
Michael Vogt
439f267378 many: replace use of "sanity" for interface implementation checks
This commit replaces the use of "sanity" with more inclusive
naming. When `// sanity` is used to check if an interface is
implemented the comment `expected interface is implemented`
is used.
2022-03-14 17:35:33 +01:00
Samuele Pedroni
5b460c56d5 asserts: support and normalize optional primary keys when signing 2022-02-28 11:13:26 +01:00
Samuele Pedroni
4308154ed2 asserts: start supporting optional primary keys, fs backstore Put/Get 2022-02-28 11:13:26 +01:00