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

fix: update the hash generation logic #1676

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aramase
Copy link
Member

@aramase aramase commented Oct 25, 2024

/kind bug

Fix the hash generation logic to prevent hash collision with different maps as input. This can be caused because of the concatenation logic.

The test added in b94492d shows the bug in the current logic.

=== RUN   TestGenerateSHAFromSecret/different_keys_with_the_same_concatenated_result_but_should_not_match
    secret_test.go:434: 
        	Error Trace:	/Users/anishramasekar/go/src/sigs.k8s.io/secrets-store-csi-driver/pkg/util/secretutil/secret_test.go:434
        	Error:      	Not equal: 
        	            	expected: false
        	            	actual  : true
        	Test:       	TestGenerateSHAFromSecret/different_keys_with_the_same_concatenated_result_but_should_not_match
--- FAIL: TestGenerateSHAFromSecret/different_keys_with_the_same_concatenated_result_but_should_not_match (0.00s)

/assign enj

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 25, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aramase

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:

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 added 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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 25, 2024
@aramase aramase changed the title Aramase/b/sha logic fix: update the hash generation logic Oct 25, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.61%. Comparing base (87f51ec) to head (aae8991).
Report is 78 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1676      +/-   ##
==========================================
+ Coverage   35.83%   36.61%   +0.78%     
==========================================
  Files          63       63              
  Lines        3759     4536     +777     
==========================================
+ Hits         1347     1661     +314     
- Misses       2268     2731     +463     
  Partials      144      144              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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. kind/bug Categorizes issue or PR as related to a bug. 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.

4 participants