WIP: Crypto - restructure for write access#52
Open
commonism wants to merge 19 commits into
Open
Conversation
used for attachments
affects {SerializationInfo,ValidationInfo,FieldValidationInfo}.context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
main intention of this PR is creating the foundation to add items such as users or logins to vault/bitwarden.
Currently implementation is limited to read-only access with users/logins.
To do so, the crypto which was inherited from bitwardentools was replaced, major parts of the crypto was moved to the pydantic models, using ModelValidator and ModelSerializers to work the crypto on the models on validation/serialization.
This eliminates all guess work when decrypting a received dataset, no loops trying to find the correct key.
The crypto when receiving data is done when validating the data.
The crypto to create new items is done when serializing the model to json using the proper key.
On sync(), SyncData is processed twice, first iteration is limed to decoding Profile, 2nd iteration decodes Ciphers as well - using the keys in Profile.Key and Profile.Organizations depending on the owner of the Cipher.
It's possible to create new users (RegisterData), logins (Login) and add attachments (Attachment) to logins (v2 api).
The tests to create users/logins/attachments modify the database and cause other tests to fail - therefore disabled for now.
The lack of proper encryption with the unit tests in tests/model/validation breaks them as well - therefore disabled for now.