138 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
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
Michael Vogt
0510676887 asserts: add some missing c.Check() in the asserts test
The staticcheck.io complained that in some places in the
assert tests values are assigned but not used. This commit
fixes this by checking the values. Alternatives we could
of course just use `_, err := ...` instead of `a, err := ...`
but checking seems slightly more sensible to me.
2022-08-16 20:56:01 +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
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
46ef068423 many: replace use of "sanity" with more inclusive naming
This commit replaces the use of "sanity" with more inclusive
naming. When "sanity" is used in a more general sense either
"validity" or "quick" is used.
2022-03-16 09:10:59 +01:00
Michael Vogt
51f2f283c1 Merge pull request #11501 from mvo5/less-sanity-2
many: replace use of "sanity" with more inclusive naming in comments
2022-03-15 16:02:20 +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
277eb06412 many: replace use of "sanity" with more inclusive naming
This commit replaces the use of "sanity" with more inclusive
naming.

When `sanity` is used in a more general sense either `validity`
or `quick` is used.
2022-03-14 18:22:34 +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
Paweł Stołowski
537b9b1612 Add preseed assertion type. 2022-02-21 16:07:49 +01:00
Samuele Pedroni
ffbb0e404c asserts: error consistency tweak 2022-02-11 15:24:41 +01:00
Samuele Pedroni
078cb5f74c asserts: first-class support for formatting/encoding signatory-id
together with checks for it
2022-02-11 15:24:41 +01:00