Skip to content

Checksum imagemanager#534

Merged
al1img merged 3 commits intoaosedge:developfrom
MykolaSuperman:checksum_imagemanager
Mar 23, 2026
Merged

Checksum imagemanager#534
al1img merged 3 commits intoaosedge:developfrom
MykolaSuperman:checksum_imagemanager

Conversation

@MykolaSuperman
Copy link

No description provided.

@MykolaSuperman MykolaSuperman force-pushed the checksum_imagemanager branch from d687a17 to e808895 Compare March 23, 2026 12:10
@@ -260,6 +260,7 @@ struct FileInfo {
FileInfo() = default;

StaticArray<uint8_t, crypto::cSHA256Size> mSHA256;
Copy link
Member

Choose a reason for hiding this comment

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

Probably we should store AlgEnum value and a static array with the ectual hash (using Max(crypto::cSHA256Size, ....) as size if needed) >

Copy link
Member

@mlohvynenko mlohvynenko left a comment

Choose a reason for hiding this comment

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

Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>

info.mSize = size;

return crypto::CalculateFileHash(path, crypto::HashEnum::eSHA256, *mHashProvider, info.mSHA256);
if (auto hashErr = crypto::CalculateFileHash(path, crypto::HashEnum::eSHA256, *mHashProvider, info.mSHA256);
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not efficient to calculate checksum twice. Add bool parameter sha3 with default set to false.

@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 90.90909% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.27%. Comparing base (47bf22b) to head (284fcd8).
⚠️ Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
src/core/cm/imagemanager/imagemanager.cpp 65.00% 7 Missing ⚠️
src/core/common/tools/fs.cpp 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #534      +/-   ##
===========================================
- Coverage    85.28%   85.27%   -0.01%     
===========================================
  Files          311      311              
  Lines        27932    27955      +23     
  Branches      3769     3772       +3     
===========================================
+ Hits         23821    23839      +18     
- Misses        4111     4116       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@mykola-kobets-epam mykola-kobets-epam left a comment

Choose a reason for hiding this comment

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

Reviewed-by: Mykola Kobets <mykola_kobets@epam.com>

@MykolaSuperman MykolaSuperman force-pushed the checksum_imagemanager branch 4 times, most recently from 2fd725e to d62e39c Compare March 23, 2026 13:09
Copy link
Collaborator

@al1img al1img left a comment

Choose a reason for hiding this comment

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

Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>

Mykola Solianko added 3 commits March 23, 2026 15:41
Replace mSHA256 with generic mCheckSum array and hashAlg parameter
in GetFileInfo to support multiple hash algorithms. Add cSHA512Size
constant.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Reviewed-by: Mykola Kobets <mykola_kobets@epam.com>
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Add pre-decrypt checksum verification using SHA3-256 against
blobInfo.mSHA256 in EnsureBlob with retry loop on mismatch.
Change post-decrypt verification in DecryptAndValidateBlob to use
VerifyBlobChecksum with blobInfo.mDigest instead of blobInfo.mSHA256.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Reviewed-by: Mykola Kobets <mykola_kobets@epam.com>
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Update GetBlobsInfos mocks to use proper 64-char hex digest matching
the test SHA256 pattern. Add mSHA3_256 population to GetFileInfo mocks
for pre-decrypt checksum verification.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Reviewed-by: Mykola Kobets <mykola_kobets@epam.com>
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
@MykolaSuperman MykolaSuperman force-pushed the checksum_imagemanager branch from d62e39c to 284fcd8 Compare March 23, 2026 13:42
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
45.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@al1img al1img merged commit de73e37 into aosedge:develop Mar 23, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants