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

refactor(general): avoid using empty master keys #3835

Merged
merged 6 commits into from
May 1, 2024

Conversation

miquella
Copy link
Contributor

@miquella miquella commented May 1, 2024

Previously, empty master keys were passed to the underlying cryptographic primitives (HKDF, AEAD, etc.).

While this worked because the authentication mechanisms returned an error, it's best to avoid passing empty master keys to these primitives in the first place. This refactor avoids passing empty master keys and enforces this via an assertion in the key derivation function.

Copy link
Collaborator

@julio-lopez julio-lopez left a comment

Choose a reason for hiding this comment

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

couple of minor nits, LG otherwise

internal/repotesting/repotesting.go Outdated Show resolved Hide resolved
internal/crypto/key_derivation_test.go Show resolved Hide resolved
@julio-lopez
Copy link
Collaborator

@bathina2 PTAL

Copy link

codecov bot commented May 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.03%. Comparing base (cb455c6) to head (fbef8d9).
Report is 126 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3835      +/-   ##
==========================================
+ Coverage   75.86%   77.03%   +1.16%     
==========================================
  Files         470      479       +9     
  Lines       37301    28713    -8588     
==========================================
- Hits        28299    22119    -6180     
+ Misses       7071     4697    -2374     
+ Partials     1931     1897      -34     

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

Comment on lines 7 to 8
"github.com/kopia/kopia/internal/crypto"
"github.com/stretchr/testify/require"
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is going to fail linting.

@julio-lopez julio-lopez merged commit 3fcdb9b into kopia:master May 1, 2024
27 checks passed
@julio-lopez julio-lopez deleted the avoid-empty-master-keys branch May 1, 2024 21:50
Copy link
Collaborator

@Shrekster Shrekster left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants