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

Make plaintext and ciphertext optional for batch operations #1049

Merged
merged 1 commit into from Sep 10, 2023

Conversation

dosisod
Copy link
Contributor

@dosisod dosisod commented Sep 9, 2023

The Vault API requires setting plaintext and ciphertext for the encrypt/decrypt data API, even though the fields are ignored when batch_input is set. This means that end users have to include an empty argument when doing batch operations, which is a bit annoying.

While this works, it might be more ergonomic to have an encrypt_data and a batch_encrypt_data function as most of the encrypt_data args are ignored in batch mode anyways, which could potentially lead to bugs. This is a bit out of scope for this PR, just thought I would mention it here as an alternative.

Also, I could not test locally due to self-signed certificate errors. Is there a certificate I need to install for testing?

@dosisod dosisod requested a review from a team as a code owner September 9, 2023 20:46
@briantist briantist self-assigned this Sep 9, 2023
@briantist briantist added enhancement a new feature or addition secrets engines generally related to a Vault secrets engine transit Transit secrets engine labels Sep 9, 2023
@codecov
Copy link

codecov bot commented Sep 9, 2023

Codecov Report

Merging #1049 (71b49d2) into main (71efa46) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1049      +/-   ##
==========================================
+ Coverage   85.00%   85.02%   +0.01%     
==========================================
  Files          65       65              
  Lines        3135     3139       +4     
==========================================
+ Hits         2665     2669       +4     
  Misses        470      470              
Files Changed Coverage Δ
hvac/api/secrets_engines/transit.py 88.74% <100.00%> (+0.30%) ⬆️

@briantist

This comment was marked as outdated.

@dosisod

This comment was marked as outdated.

Copy link
Contributor

@briantist briantist left a comment

Choose a reason for hiding this comment

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

Thanks again for putting up this PR and especially for adding tests. Could you rebase this to include the latest changes in main?

hvac/api/secrets_engines/transit.py Outdated Show resolved Hide resolved
hvac/api/secrets_engines/transit.py Outdated Show resolved Hide resolved
hvac/api/secrets_engines/transit.py Outdated Show resolved Hide resolved
hvac/api/secrets_engines/transit.py Outdated Show resolved Hide resolved
The Vault API requires setting `plaintext` and `ciphertext` for the encrypt
and decrypt API, even though they are ignored when `batch_input` is set. This
means that end users have to include an empty argument when doing batch
operations, which is a bit annoying.
@briantist briantist added this to the 2.0.0 milestone Sep 10, 2023
Copy link
Contributor

@briantist briantist left a comment

Choose a reason for hiding this comment

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

Looks great, thanks again @dosisod ! We're actively looking for contributors so if you're interested please don't be a stranger :)

@briantist briantist merged commit 356b3d8 into hvac:main Sep 10, 2023
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement a new feature or addition secrets engines generally related to a Vault secrets engine transit Transit secrets engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants