-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
refactored archive installer #12771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactored archive installer #12771
Conversation
Test Results (amd64) - Integration, Bootstrap 5 files 5 suites 2h 21m 11s ⏱️ Results for commit 58328ae. ♻️ This comment has been updated with latest results. |
c73fb20
to
ee94cbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this great push! In my opinion, this is really a big step towards introducing integrity checks on a broader scope, which will enable us in the future to use external sources without lowering the trust, and we can avoid download issues / detect MITM attacks! 🚀
Everything is looking good, I just added a few comments, questions, and nitpicks. Happy to discuss them directly :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks a lot for jumping on all the comments! In my opinion, the result is really looking great! I added a few nitpicks, you can maybe directly follow up on these, but nothing is blocking a merge from my point. 💯
# Detect algorithm based on checksum length | ||
checksum_length = len(expected_checksum) | ||
if checksum_length == 32: | ||
algorithm = "md5" | ||
elif checksum_length == 40: | ||
algorithm = "sha1" | ||
elif checksum_length == 64: | ||
algorithm = "sha256" | ||
elif checksum_length == 128: | ||
algorithm = "sha512" | ||
else: | ||
raise ChecksumException(f"Unsupported checksum length: {checksum_length}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This seems a bit brittle and redundant. What if there are two different hash algorithms with the same size? Shouldn't the checksum parsers return the algorithm together with the hashes? Definitely not blocking a merge though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Changing this would require updating a lot of other places. Would be great if we can tackle this in a follow-up PR.
Motivation
Refactors the
ArchiveDownloadAndExtractInstaller
class to improve modularity and adds checksum verification support for enhanced security and reliability when downloading packages.Changes
extracted reusable methods from
_install
method_download_and_extract_archive
- downloads and extracts archive_handle_single_directory_extraction
- handles logic for extracting all files in a single root directoryimproves cleanup with proper
try/finally
blockAdded checksum URLs for
FfmpegPackageInstaller
andTerraformPackageInstaller
Added checksum verification: New
localstack.utils.checksum
module with:download_and_extract
function