Skip to content
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

pkg/index: validate sha256 values #281

Merged
merged 1 commit into from
Jul 21, 2019

Conversation

ahmetb
Copy link
Member

@ahmetb ahmetb commented Jul 20, 2019

This makes sure the code only deals with valid lowercase sha256 values
(i.e. all lowercase) while doing comparisons etc.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 20, 2019
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 20, 2019
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 20, 2019
@ahmetb
Copy link
Member Author

ahmetb commented Jul 20, 2019

This is expected to have merge-conflicts with #278 as it updates some test cases deleted in that PR.

@codecov-io
Copy link

codecov-io commented Jul 20, 2019

Codecov Report

Merging #281 into master will increase coverage by 0.57%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #281      +/-   ##
==========================================
+ Coverage   54.91%   55.49%   +0.57%     
==========================================
  Files          19       19              
  Lines         874      883       +9     
==========================================
+ Hits          480      490      +10     
+ Misses        341      337       -4     
- Partials       53       56       +3
Impacted Files Coverage Δ
pkg/index/validate.go 95.34% <100%> (+0.34%) ⬆️
pkg/installation/install.go 32% <0%> (-2.32%) ⬇️
pkg/installation/upgrade.go 0% <0%> (ø) ⬆️
pkg/installation/util.go 48.88% <0%> (+7.5%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f346eba...83c2c00. Read the comment docs.

Copy link
Contributor

@corneliusweig corneliusweig left a comment

Choose a reason for hiding this comment

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

One small nit. Otherwise looks great.

@@ -93,6 +96,9 @@ func (p Platform) Validate() error {
if p.Sha256 == "" {
return errors.New("sha256 sum has to be set")
}
if !isValidSHA256(p.Sha256) {
return errors.Errorf("sha256 value %s is not a valid sha256sum string", p.Sha256)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you mention the requirement, that the string is expected to be lower-case?

Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to include the pattern in the error message.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 20, 2019
This makes sure the code only deals with valid lowercase sha256 values
(i.e. all lowercase) while doing comparisons etc.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 21, 2019
@corneliusweig
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 21, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmetb, corneliusweig

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [ahmetb,corneliusweig]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 44caf6c into kubernetes-sigs:master Jul 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants