52 Commits

Author SHA1 Message Date
Samuele Pedroni
cbddde69ff a/snapasserts: add a test about DeriveSideInfo* ambiguity limitations 2022-07-22 18:25:10 +02:00
Samuele Pedroni
21e2207e9e many: support non-default provenance snap-revisions in DeriveSideInfo*
snapsserts.DeriveSideInfo* cannot deal with snap-revisions with the
same hash but different provenance in the local system assertion
database, this should be an acceptable limitation for a while

the seedwriter code now assumes that the input can be trusted, this is
reasonable

systems.go uses already installed snaps, so it's fine but probably
would still be good to address the TODO in it for efficiency/clarity
as the code in seedwriter DeriveSideInfo is even more clunky now for
this use case, we should be able to find an applicable snap-revision
by other means
2022-07-22 11:30:28 +02:00
Samuele Pedroni
1ca77ad4e2 image,a/snapasserts: doc comment improvements/formatting
from comments on the previous PR and this, thanks @mardy, @MiguelPires
2022-07-21 09:17:14 +02:00
Samuele Pedroni
a58b5b6640 many: snap revision fetching and cross-checking for delegation
snap revision fetching and cross-checking should take provenance into
account and also verify device scope constraints for revision
authority delegation

provenance is taken as a hint from the store, but then matching
assertions must be found and then provenance is double checked

a failure of the latter check is likely a sign of a bug or
error as an attacker that can submit or forge/sign a blob could
as well do one with the expected provenance

provenance goals are tracing and avoiding the risk of polluting
the snap-revision namespace

this leaves alone the DeriveSideInfo* functions mainly used for
asserted local installs, this means they might fail to find a
snap-revision sometimes, they will be updated in a different branch.
2022-07-20 11:03:20 +02:00
Samuele Pedroni
b670e9a185 many: snapasserts.DeriveSideInfo* take a model assertion
this will be used to perform the device specific part of full cross
checks for delegated authority snap-revisions
2022-07-18 20:36:18 +02:00
Samuele Pedroni
bac14a21a4 many: snapasserts.CrossChecks takes a model assertion optionally
this will be used to perform the device specific part of full cross
checks for delegated authority snap-revisions
2022-07-18 14:28:46 +02:00
Paweł Stołowski
386ebcd978 Also add a validation set that doesn't require a specific revision. 2022-06-20 16:49:01 +02:00
Paweł Stołowski
387c216bee Cover the case where same revision of a snap is required by 2 validation sets. 2022-06-20 16:49:01 +02:00
Paweł Stołowski
be2ef2c7da Determine required revisions for missing snaps. 2022-06-20 16:49:01 +02:00
Samuele Pedroni
cbcc460bdc a/snapasserts: tweak/rewrap the DeriveSideInfo* doc comments 2022-04-25 11:05:14 +02:00
Samuele Pedroni
c848f677d8 a/snapasserts: introduce DeriveSideInfoFromDigestAndSize
this is simply split out from DeriveSideInfo
2022-04-22 17:41:14 +02: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
Paweł Stołowski
7d1fa87e1b Check ignoreValidation condition before the main switch (thanks
pedronis).
2021-10-22 09:56:46 +02:00
Paweł Stołowski
32c8a4c8ab Honor ignoreValidation flag on snaps when checking installed snaps
against enforce validation sets.
2021-10-22 09:52:28 +02:00
Paweł Stołowski
37e4b217c4 Use Ref().PrimaryKey instead of At().PrimaryKey (thanks pedronis). 2021-09-17 09:38:32 +02:00
Paweł Stołowski
b1fbca56a9 Return full validation set keys from CheckPresenceRequired and
CheckPresenceInvalid; full keys including series and sequence are
expected by store api.
2021-09-17 09:38:32 +02:00
Paweł Stołowski
8e094d70b3 Add doc comment to PresenceConstraintError. 2021-07-27 08:18:29 +02:00
Paweł Stołowski
cc9cf4dfdf Fix format. 2021-07-27 08:12:37 +02:00
Paweł Stołowski
9b47121247 Introduce PresenceConstraintError. 2021-07-27 08:12:37 +02:00
Paweł Stołowski
b8afc08fe1 Return an error from CheckPresenceRequired and CheckPresenceInvalid if
the presence if opposite to what the function is about.
2021-07-27 08:12:37 +02:00
Paweł Stołowski
64807cb59c Implement CheckPresenceInvalid and CheckPresenceRequired methods for
ValidationSets.
2021-07-27 08:12:37 +02:00
Samuele Pedroni
f2cdb6dd92 asserts,interfaces,snap: fix imports order (according to gci) 2021-06-14 20:54:41 +02:00
Alberto Mardegan
37e83765f3 asserts: fix errors reported by linter
Besides some trivial fixes, this also adds the (previously unused) class
`isUnacceptedUpdateSuite` to the tests suite.
2021-05-05 10:16:20 +03:00
Paweł Stołowski
eb65e1164e Add unit test. 2021-01-15 14:48:30 +00:00
Paweł Stołowski
8b8d548614 Implement and use byRevision sort for validation sets errors (thanks bboozzoo). 2021-01-14 15:31:10 +00:00