-
Notifications
You must be signed in to change notification settings - Fork 362
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
Validate checksums when fetching cached files for app packaging #4081
Conversation
880e0c6
to
ef5df5c
Compare
* This also deletes any resources with bad/mismatched checksums
ef5df5c
to
a174d5d
Compare
@@ -132,7 +132,7 @@ def make_request | |||
end | |||
|
|||
context 'with at least one resource and an application' do | |||
let(:req_body) { { resources: Oj.dump([{ 'fn' => 'lol', 'sha1' => 'abc', 'size' => 2048 }]), application: valid_zip } } | |||
let(:req_body) { { resources: Oj.dump([{ 'fn' => 'lol', 'sha1' => 'da39a3ee5e6b4b0d3255bfef95601890afd80709', 'size' => 2048 }]), application: valid_zip } } |
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.
question (non-blocking): why do we want a valid sha for these units? Can we mock the underlying library?
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.
The unit tests write/read from a tmp directory: https://github.com/cloudfoundry/cloud_controller_ng/pull/4081/files#diff-919d005706d6fa1e2f65027b4718eab4c664001c3d8d5893ee5395bb47350335L20-L28
Changes in cloud_controller_ng: - Validate checksums when fetching cached files for app packaging PR: cloudfoundry/cloud_controller_ng#4081 Author: Seth Boyles <seth.boyles@broadcom.com>
Although resource matching stores files by their sha1 checksum, when later fetching the resource to include in app packaging, the bits packer does not validate the checksum still matches. The packer will still include the corrupted file, and users (most likely) won't receive an error until the staging process. This state is only recoverable by clearing the resource cache, which relies on operator intervention.
With this change, when a bad checksum is found, the cached resource(s) are deleted, and an error is raised, causing faster feedback. Since the cached resources have been deleted, a second push/package upload should succeed.
I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
main
branchI have run all the unit tests using
bundle exec rake
I have run CF Acceptance Tests