-
Notifications
You must be signed in to change notification settings - Fork 24
[PM-25821] Migrate Cipher Admin operation API calls to SDK #560
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
base: main
Are you sure you want to change the base?
Conversation
|
Great job! No new security vulnerabilities introduced in this pull request |
🔍 SDK Breaking Change Detection ResultsSDK Version:
Breaking change detection completed. View SDK workflow |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #560 +/- ##
==========================================
- Coverage 78.84% 78.70% -0.14%
==========================================
Files 283 290 +7
Lines 29660 31121 +1461
==========================================
+ Hits 23384 24493 +1109
- Misses 6276 6628 +352 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
aa8a96d to
7dc66a5
Compare
… vault/pm-25821/cipher-admin-ops
Hinton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of my issues are resolved and I think this looks generally good. There are couple of smaller things and improvements to be made but once resolved feel free to not request another review from me.
| mod get; | ||
| mod restore; | ||
|
|
||
| #[allow(missing_docs)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Document the purpose of this client and compare it against the regular CipherClient?
| #[error(transparent)] | ||
| Api(#[from] ApiError), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea sounds good.
crates/bitwarden-vault/src/cipher/cipher_client/admin/delete.rs
Outdated
Show resolved
Hide resolved
| VaultParse(#[from] VaultParseError), | ||
| #[error(transparent)] | ||
| RepositoryError(#[from] RepositoryError), | ||
| #[error(transparent)] | ||
| Api(#[from] ApiError), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: Remove? Now that you have the admin error these can be removed right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, these are still used by the operations, since they make API calls and parse the responses using the non-admin endpoints. The Admin operations only apply in certain use cases.
| /// Used to convert from API response models to full Cipher structs, | ||
| /// without losing local data that may not be present in the API response. | ||
| pub(crate) trait PartialCipher { | ||
| fn merge_with_cipher(self, cipher: Option<Cipher>) -> Result<Cipher, VaultParseError>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Why accept an optional cipher? The function might be nicer if cipher is required and you just do and_then on callers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have some situations where we don't necessarily have the original cipher when parsing the response - the intent is to allow the functions to create a Cipher object from the details in the response, in that event.
… vault/pm-25821/cipher-admin-ops

🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-25821
📔 Objective
Migrates the logic for orchestrating API calls for several operations related to the Admin API functionality. Adds the following operations to
CiphersClient, which call the appropriate API endpoints:PR Notes: Sorry for the heft - The line count is high on this PR, but a majority of it is unit tests. This should have been split into multiple tickets, in hindsight.
Note also that this hasn't been tested directly with the client yet, and so additional changes may be needed if bugs are discovered when integrating into the clients (future tickets) - these operations are not currently used anywhere.
⏰ Reminders before review
team
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmedissue and could potentially benefit from discussion
:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes