mirror of
https://github.com/bitwarden/server.git
synced 2024-12-03 14:03:33 +01:00
989d4df599
* Direct upload to azure To validate file sizes in the event of a rogue client, Azure event webhooks will be hooked up to AzureValidateFile. Sends outside of a grace size will be deleted as non-compliant. TODO: LocalSendFileStorageService direct upload method/endpoint. * Quick respond to no-body event calls These shouldn't happen, but might if some errant get requests occur * Event Grid only POSTS to webhook * Enable local storage direct file upload * Increase file size difference leeway * Upload through service * Fix LocalFileSendStorage It turns out that multipartHttpStreams do not have a length until read. this causes all long files to be "invalid". We need to write the entire stream, then validate length, just like Azure. the difference is, We can return an exception to local storage admonishing the client for lying * Update src/Api/Utilities/ApiHelpers.cs Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * Do not delete directory if it has files * Allow large uploads for self hosted instances * Fix formatting * Re-verfiy access and increment access count on download of Send File * Update src/Core/Services/Implementations/SendService.cs Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * Add back in original Send upload * Update size and mark as validated upon Send file validation * Log azure file validation errors * Lint fix Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com>
21 lines
759 B
C#
21 lines
759 B
C#
using Bit.Core.Enums;
|
|
using Bit.Core.Models.Table;
|
|
using System;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Bit.Core.Services
|
|
{
|
|
public interface ISendFileStorageService
|
|
{
|
|
FileUploadType FileUploadType { get; }
|
|
Task UploadNewFileAsync(Stream stream, Send send, string fileId);
|
|
Task DeleteFileAsync(Send send, string fileId);
|
|
Task DeleteFilesForOrganizationAsync(Guid organizationId);
|
|
Task DeleteFilesForUserAsync(Guid userId);
|
|
Task<string> GetSendFileDownloadUrlAsync(Send send, string fileId);
|
|
Task<string> GetSendFileUploadUrlAsync(Send send, string fileId);
|
|
Task<(bool, long?)> ValidateFileAsync(Send send, string fileId, long expectedFileSize, long leeway);
|
|
}
|
|
}
|