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

Remove encrypt from EncryptionSettings #314

Merged
merged 3 commits into from
Nov 3, 2023

Conversation

dani-garcia
Copy link
Member

Type of change

- [ ] Bug fix
- [ ] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

After #297, there were some places in the secrets manager parts of the code that used EncryptionSettings to encrypt directly, instead of dealing with the Encryptable/KeyEncryptable trait. This PR removes those uses so that all encryption opearations have to go through Encryptable/KeyEncryptable.

@dani-garcia dani-garcia requested a review from Hinton October 30, 2023 16:16
@bitwarden-bot
Copy link

bitwarden-bot commented Oct 30, 2023

Logo
Checkmarx One – Scan Summary & Details996ee074-34b3-488f-9fe1-19a0692e9aa5

No New Or Fixed Issues Found

Comment on lines +37 to +39
key: input.key.clone().encrypt_with_key(key)?.to_string(),
value: input.value.clone().encrypt_with_key(key)?.to_string(),
note: input.note.clone().encrypt_with_key(key)?.to_string(),
Copy link
Member

Choose a reason for hiding this comment

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

This makes me doubt that having encryptable interface consuming the string was correct 😩. @MGibson1

Would to_owned() be more appropriate than clone?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is to_owned() and to_string(), either would work too, yeah.

Ultimately if we want the Encryptable interface to consume the decrypted items, we need to change the APIs to take the requests by value and not by reference, which is a breaking change, otherwise at some point we're going to need to copy the values to have ownership of them.

@dani-garcia dani-garcia merged commit 13a195c into master Nov 3, 2023
45 checks passed
@dani-garcia dani-garcia deleted the ps/remove-encrypt-from-encsettings branch November 3, 2023 10:06
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.

3 participants