-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add test for invalid hash algorithm for package checksum #108
Conversation
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.
@achilleas-k I wasn't expecting the test to pass in its current form. Can you review ?
ce2e5f6
to
7e8f607
Compare
I added validation to sources for the checksums. I moved the validation into the sources instead of the inputs to mirror what we actually do in osbuild. The checksums are defined per-source, meaning different source types have different checksum requirements. So I did the same here and added a checksum validation for curl sources that represent rpm packages. I also kept the old checksum validator in the file inputs. |
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.
I added a few inline comments. Otherwise, the PR looks good 👍
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.
Test LGTM.
The inline and skopeo sources have constructors for the source itself (New...Source()) and the items (New...Item()) as well as an AddItem() method. These are convenient and make source creation consistent and easier to validate. Add the same functions for curl and ostree sources. For the curl source, the method is called AddPackage() because technically the source supports downloading any type of file.
Check that the package checksum is valid when creating a CurlSourceItem of that type. The regex matches the one in the osbuild source schema.
Run the item's validate() method immediately after creating it in the constructor function.
Use the new helper functions to generate all the sources in GenSources().
Co-Authored-By: Achilleas Koutsou <[email protected]>
Check the error value returned from curl.AddPackage() in GenSources() and pass it up to the Serialize() function where it's called.
7e8f607
to
04a4a49
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.
Nice work! Thanks.
No description provided.