mirror of
https://github.com/bitwarden/server
synced 2025-12-26 13:13:24 +00:00
* 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.
74 lines
2.3 KiB
C#
74 lines
2.3 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
using Bit.Core.Enums;
|
|
using Bit.Core.Models.Data;
|
|
using Bit.Core.Models.Table;
|
|
|
|
namespace Bit.Core.Services
|
|
{
|
|
public class NoopAttachmentStorageService : IAttachmentStorageService
|
|
{
|
|
public FileUploadType FileUploadType => FileUploadType.Direct;
|
|
|
|
public Task CleanupAsync(Guid cipherId)
|
|
{
|
|
return Task.FromResult(0);
|
|
}
|
|
|
|
public Task DeleteAttachmentAsync(Guid cipherId, CipherAttachment.MetaData attachmentData)
|
|
{
|
|
return Task.FromResult(0);
|
|
}
|
|
|
|
public Task DeleteAttachmentsForCipherAsync(Guid cipherId)
|
|
{
|
|
return Task.FromResult(0);
|
|
}
|
|
|
|
public Task DeleteAttachmentsForOrganizationAsync(Guid organizationId)
|
|
{
|
|
return Task.FromResult(0);
|
|
}
|
|
|
|
public Task DeleteAttachmentsForUserAsync(Guid userId)
|
|
{
|
|
return Task.FromResult(0);
|
|
}
|
|
|
|
public Task RollbackShareAttachmentAsync(Guid cipherId, Guid organizationId, CipherAttachment.MetaData attachmentData, string originalContainer)
|
|
{
|
|
return Task.FromResult(0);
|
|
}
|
|
|
|
public Task StartShareAttachmentAsync(Guid cipherId, Guid organizationId, CipherAttachment.MetaData attachmentData)
|
|
{
|
|
return Task.FromResult(0);
|
|
}
|
|
|
|
public Task UploadNewAttachmentAsync(Stream stream, Cipher cipher, CipherAttachment.MetaData attachmentData)
|
|
{
|
|
return Task.FromResult(0);
|
|
}
|
|
|
|
public Task UploadShareAttachmentAsync(Stream stream, Guid cipherId, Guid organizationId, CipherAttachment.MetaData attachmentData)
|
|
{
|
|
return Task.FromResult(0);
|
|
}
|
|
|
|
public Task<string> GetAttachmentDownloadUrlAsync(Cipher cipher, CipherAttachment.MetaData attachmentData)
|
|
{
|
|
return Task.FromResult((string)null);
|
|
}
|
|
|
|
public Task<string> GetAttachmentUploadUrlAsync(Cipher cipher, CipherAttachment.MetaData attachmentData)
|
|
{
|
|
return Task.FromResult(default(string));
|
|
}
|
|
public Task<(bool, long?)> ValidateFileAsync(Cipher cipher, CipherAttachment.MetaData attachmentData, long leeway)
|
|
{
|
|
return Task.FromResult((false, (long?)null));
|
|
}
|
|
}
|
|
}
|