-
Notifications
You must be signed in to change notification settings - Fork 44
[PM-41576] PAM partial filtered data #1359
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
Changes from 6 commits
b19f4d4
d5b3813
183204e
fb0516c
91e7ec0
11dcbb9
93a3b79
10442b5
b10e1c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,6 +93,14 @@ pub(crate) fn encrypt_blob_cipher_with_wrapping_key( | |
| ctx: &mut KeyStoreContext<KeySlotIds>, | ||
| wrapping_key: SymmetricKeySlotId, | ||
| ) -> Result<Cipher, BlobEncryptionError> { | ||
| // Fail closed: a restricted (partial) view has all secret fields stripped; re-encrypting it | ||
| // would overwrite the item's secrets with empty values. See `decrypt_restricted_cipher_view`. | ||
| if view.partial { | ||
| return Err(BlobEncryptionError::Crypto( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Hinton where does the partial view come from? Assuming that - as asked above - only org ciphers have partial views, then blob ciphers won't immediately be a problem, but become a problem as soon as we undertake organizations moving to blob ciphers. Is the plan to:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this path is actually always correct. You wouldn't want to re-encrypt the partial data. Updates should be done on the full cipher. Blobs will impact conversion to PAM and PAM updates, though, since the server can no longer separate our the partial data from the full data.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Partials comes from the sync.
|
||
| CryptoError::EncryptRestrictedView, | ||
| )); | ||
| } | ||
|
|
||
| if view.key.is_none() { | ||
| view.generate_cipher_key(ctx, wrapping_key)?; | ||
| } | ||
|
|
@@ -108,6 +116,7 @@ pub(crate) fn encrypt_blob_cipher_with_wrapping_key( | |
| let name = "".encrypt(ctx, cipher_key)?; | ||
|
|
||
| Ok(Cipher { | ||
| partial_data: None, | ||
| // Metadata | ||
| id: view.id, | ||
| organization_id: view.organization_id, | ||
|
|
@@ -175,6 +184,7 @@ pub(crate) fn decrypt_blob_cipher( | |
| let local_data = cipher.local_data.decrypt(ctx, cipher_key).ok().flatten(); | ||
|
|
||
| let mut view = CipherView { | ||
| partial: false, | ||
| // Metadata | ||
| id: cipher.id, | ||
| organization_id: cipher.organization_id, | ||
|
|
@@ -250,6 +260,7 @@ mod tests { | |
| ) | ||
| .unwrap(); | ||
| Cipher { | ||
| partial_data: None, | ||
| id: None, | ||
| organization_id: None, | ||
| folder_id: None, | ||
|
|
||
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.
Is this a guarantee? Are we never allowing import/export of partials?
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.
Yes, partials is not import/exportable.