Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Fix/ota 4941/installed version matching #1666

Merged
merged 5 commits into from
May 5, 2020

Conversation

pattivacek
Copy link
Collaborator

No description provided.

@pattivacek pattivacek requested review from zabbal, lbonn, a user, eu-siemann and kbushgit May 5, 2020 10:49
@@ -115,7 +115,7 @@ void ImageRepository::fetchTargets(INvStorage& storage, const IMetadataFetcher&
verifyTargets(image_targets, false);

if (local_version > remote_version) {
throw Uptane::SecurityException(RepositoryType::IMAGE, "Mismatched target versions");
throw Uptane::SecurityException(RepositoryType::IMAGE, "Rollback attempt");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks like smth which deserves big bold red error in the log output. Is this done where this exception is caught?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe so, although the real tragedy is we don't think we make this particularly obvious in the web UI.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I though there's a ticket for that but can't find it now.

@@ -110,6 +110,7 @@ bool PackageManagerFake::fetchTarget(const Uptane::Target& target, Uptane::Fetch
return false;
}

// TODO(OTA-4939): Unify this and make it more generic.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps explicitly saying unification with what exactly is desired would be helpful in future? Like function name or file for example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, done.

pattivacek added 5 commits May 5, 2020 14:26
Signed-off-by: Patrick Vacek <patrickvacek@gmail.com>
Functionally should be no change. I'm just trying to make the online and
offline metadata checks as similar as possible, as well as the handling
of the Director and Image repo.

Signed-off-by: Patrick Vacek <patrickvacek@gmail.com>
Signed-off-by: Patrick Vacek <patrickvacek@gmail.com>
Specifically, if metadata content changes but the version is not
updated.

Signed-off-by: Patrick Vacek <patrickvacek@gmail.com>
This is the same function used for matching Targets from the Director
and Image repo. Notably, it also matches hashes and length.

Functionally, this shouldn't change much in practice, but if a Target is
received in the Director Targets metadata that matches the filename of
the currently installed version but *not* the length and/or hashes, we
throw an error, since that is unexpected. This is covered by a test.

Signed-off-by: Patrick Vacek <patrickvacek@gmail.com>
@pattivacek pattivacek force-pushed the fix/OTA-4941/installed-version-matching branch from 5173bcc to 1230c4f Compare May 5, 2020 12:26
@codecov-io
Copy link

codecov-io commented May 5, 2020

Codecov Report

Merging #1666 into master will increase coverage by 0.00%.
The diff coverage is 95.65%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1666   +/-   ##
=======================================
  Coverage   82.68%   82.69%           
=======================================
  Files         191      191           
  Lines       12088    12088           
=======================================
+ Hits         9995     9996    +1     
+ Misses       2093     2092    -1     
Impacted Files Coverage Δ
...libaktualizr/package_manager/packagemanagerfake.cc 92.06% <ø> (ø)
src/libaktualizr/uptane/directorrepository.cc 93.58% <ø> (ø)
src/libaktualizr/uptane/imagerepository.cc 86.95% <0.00%> (ø)
src/libaktualizr/primary/sotauptaneclient.cc 90.80% <100.00%> (+0.08%) ⬆️
src/libaktualizr/uptane/exceptions.h 91.52% <100.00%> (+0.45%) ⬆️
src/libaktualizr/storage/sql_utils.h 83.11% <0.00%> (-2.60%) ⬇️
src/libaktualizr/storage/sqlstorage.cc 80.13% <0.00%> (+0.09%) ⬆️
src/libaktualizr/uptane/tuf.cc 91.63% <0.00%> (+0.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f6fcc8c...1230c4f. Read the comment docs.

@pattivacek pattivacek merged commit 647f691 into master May 5, 2020
@pattivacek pattivacek deleted the fix/OTA-4941/installed-version-matching branch May 5, 2020 14:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants