-
Notifications
You must be signed in to change notification settings - Fork 43
Add SHA256 checksum verification and robust URL validation for image #824
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
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tsj-30 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Welcome @tsj-30! It looks like this is your first PR to ppc64le-cloud/pvsadm 🎉 |
|
Hi @tsj-30. Thanks for your PR. I'm waiting for a ppc64le-cloud member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@sudeeshjohn anyone using this script? may be need your reviewing this script |
samples/convert-upload-images-powervs/convert-upload-images-powervs
Outdated
Show resolved
Hide resolved
samples/convert-upload-images-powervs/convert-upload-images-powervs
Outdated
Show resolved
Hide resolved
|
I would suggest to add the checksum validation in getImage function as well pvsadm/cmd/image/qcow2ova/get-image.go Line 34 in 1936990
|
samples/convert-upload-images-powervs/convert-upload-images-powervs
Outdated
Show resolved
Hide resolved
samples/convert-upload-images-powervs/convert-upload-images-powervs
Outdated
Show resolved
Hide resolved
samples/convert-upload-images-powervs/convert-upload-images-powervs
Outdated
Show resolved
Hide resolved
|
/ok-to-test |
What this PR does / why we need it:
This PR adds SHA-256 checksum verification and robust URL validation for image downloads in the convert-upload-images-powervs script.
It ensures that corrupted or partially downloaded .qcow2 images (caused by unescaped characters like & in URLs) are detected and the script terminates safely instead of continuing with invalid data.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #92
Special notes for your reviewer:
**Output/Demonstration
sjtharun@Ss-MacBook-Pro convert-upload-images-powervs % ./convert-upload-images-powervs
--rhel-url "https://cloud.centos.org/centos/10-stream/ppc64le/images/CentOS-Stream-GenericCloud-10-20241118.0.ppc64le.qcow2"
--rhel-sha256 "27bdeb53a4e265409adcf37caa87103a5c544640fc99da19c06f6ff1dd389b30" \
+zsh:77> ./convert-upload-images-powervs --rhel-url https://cloud.centos.org/centos/10-stream/ppc64le/images/CentOS-Stream-GenericCloud-10-20241118.0.ppc64le.qcow2 --rhel-sha256 27bdeb53a4e265409adcf37caa87103a5c544640fc99da19c06f6ff1dd389b30
LOG: =========================================
LOG: Starting download: CentOS-Stream-GenericCloud-10-20241118.0.ppc64le.qcow2
LOG: Source URL: https://cloud.centos.org/centos/10-stream/ppc64le/images/CentOS-Stream-GenericCloud-10-20241118.0.ppc64le.qcow2
LOG: =========================================
LOG: Download attempt 1 of 3
LOG: Downloading CentOS-Stream-GenericCloud-10-20241118.0.ppc64le.qcow2...
LOG: Download completed, verifying integrity...
LOG: Verifying file size for CentOS-Stream-GenericCloud-10-20241118.0.ppc64le.qcow2...
LOG: Expected size: 739220480 bytes
LOG: Actual size: 739220480 bytes
SUCCESS: ✓ File size verification PASSED
LOG: Verifying SHA256 checksum for CentOS-Stream-GenericCloud-10-20241118.0.ppc64le.qcow2...
LOG: Expected: 27bdeb53a4e265409adcf37caa87103a5c544640fc99da19c06f6ff1dd389b30
LOG: Actual: 27bdeb53a4e265409adcf37caa87103a5c544640fc99da19c06f6ff1dd389b30
SUCCESS: ✓ Checksum verification PASSED for CentOS-Stream-GenericCloud-10-20241118.0.ppc64le.qcow2
SUCCESS: =========================================
SUCCESS: ✓ Download and verification completed successfully!
SUCCESS: File: CentOS-Stream-GenericCloud-10-20241118.0.ppc64le.qcow2
SUCCESS: Location: ./CentOS-Stream-GenericCloud-10-20241118.0.ppc64le.qcow2
SUCCESS: =========================================