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

allow null types in batch encryption [VAULT-849] #10386

Merged
merged 4 commits into from
Nov 23, 2020
Merged

allow null types in batch encryption [VAULT-849] #10386

merged 4 commits into from
Nov 23, 2020

Conversation

HridoyRoy
Copy link
Contributor

This PR is to allow null values in the encryption payload, so as to be backward compatible with 1.4 functionality.

@ncabatoff ncabatoff removed their request for review November 16, 2020 13:37
@@ -154,39 +155,49 @@ func decodeBatchRequestItems(src interface{}, dst *[]BatchRequestItem) error {
}

if v, has := item["context"]; has {
if casted, ok := v.(string); ok {
val := reflect.ValueOf(v)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: We may not need val. How about if !reflect.ValueOf(v).IsValid()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good! Thank you for the review!

Copy link
Member

@vishalnayak vishalnayak 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 comment. Otherwise this is looking good.

@HridoyRoy
Copy link
Contributor Author

I updated the PR to not allow plaintext to be "null". Everything else can have a "null" string as a value, as they are optional parameters in different situations. I let the ciphertext field be "null" as well, even though it shouldn't be necessary, because this value is not set by a vault user.

@HridoyRoy HridoyRoy merged commit 6fb85f1 into master Nov 23, 2020
@HridoyRoy HridoyRoy deleted the VAULT-849 branch November 23, 2020 19:55
@HridoyRoy HridoyRoy added this to the 1.6.1 milestone Nov 23, 2020
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.

2 participants