-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Attachment blob upload #1229
Merged
Merged
Attachment blob upload #1229
Conversation
This file contains 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
This bool is used to determine whether or not to renew upload links
The two cipher properties represent the two different cipher model types that can be returned. Cipher Response from personal items and mini response from organizations
MGibson1
force-pushed
the
attachment-blob-upload
branch
from
March 22, 2021 17:18
f071de8
to
7c12aec
Compare
addisonbeck
reviewed
Mar 23, 2021
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.
A lot of this is a little whoosh for me (maybe a quick meeting to break down the changes for those of us that haven't been actively involved in this stuff?) but I did spot one weird thing 😁
cscharf
reviewed
Mar 25, 2021
As long as we have the required information, we should always delete attachments from each the Repository, the cipher in memory, and the file storage service to ensure they're all synched.
cscharf
approved these changes
Mar 30, 2021
addisonbeck
pushed a commit
that referenced
this pull request
Apr 8, 2021
* Add Cipher attachment upload endpoints * Add validation bool to attachment storage data This bool is used to determine whether or not to renew upload links * Add model to request a new attachment to be made for later upload * Add model to respond with created attachment. The two cipher properties represent the two different cipher model types that can be returned. Cipher Response from personal items and mini response from organizations * Create Azure SAS-authorized upload links for both one-shot and block uploads * Add service methods to handle delayed upload and file size validation * Add emergency access method for downloading attachments direct from Azure * Add new attachment storage methods to other services * Update service interfaces * Log event grid exceptions * Limit Send and Attachment Size to 500MB * capitalize Key property * Add key validation to Azure Event Grid endpoint * Delete blob for unexpected blob creation events * Set Event Grid key at API startup * Change renew attachment upload url request path to match Send * Shore up attachment cleanup method. As long as we have the required information, we should always delete attachments from each the Repository, the cipher in memory, and the file storage service to ensure they're all synched.
jjlin
added a commit
to jjlin/vaultwarden
that referenced
this pull request
May 25, 2021
jjlin
added a commit
to jjlin/vaultwarden
that referenced
this pull request
May 25, 2021
jjlin
added a commit
to jjlin/vaultwarden
that referenced
this pull request
May 25, 2021
jjlin
added a commit
to jjlin/vaultwarden
that referenced
this pull request
May 25, 2021
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.
Overview
Server-side changes to support direct upload for cipher attachments. Similar changes to #1188.
Special care must be taken handling attachments which were uploaded prior to these changes. There are a few concerns here. Chief is that the
attachments
container is publicly available on the blob level. We can't give direct links to those attachments without either breaking old clients or allowing unfettered access to our storage accounts.Therefore, a second
attachments-v2
storage container is necessary. The container an attachment is stored in is saved along its other metadata, assumingattachments
if not present.Also Limits Send and Attachment size to 500MB per discussion this morning. Further evaluation on legitimate use cases may push this limit further, so it's defined as a couple of constants for Send and Cipher Attachments separately.
Files Changed
attachments
(the old container) is used everywhere unless using the new separate upload scheme by accessingGetAttachmentUploadUrlAsync
, which only exists in new clients capable of uploading/downloading from Azure directly. Validate needs to set metadata since the blob is actually created by the client and we don't want to leave that job to trusting the client.