Add BLOB Pipeline and ByteEncryption Support#25836
Open
ugurozturk wants to merge 1 commit into
Open
Conversation
…decryption - Introduced IByteArrayEncryptionService interface for encrypting and decrypting binary data with authenticated encryption. - Implemented methods for encrypting and decrypting byte arrays and streams, including options for passphrase and salt. - Enhanced blob storing tests to cover encryption scenarios, including tenant-specific passphrases and custom pipeline contributors. - Added FakeInMemoryBlobProvider and various test containers to facilitate testing of blob storage with encryption. - Created unit tests for ByteArrayEncryptionService to validate encryption and decryption functionality, including edge cases for tampered data and oversized chunks.
maliming
self-requested a review
July 20, 2026 01:43
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.
Description
Resolves #25835
This PR introduces a provider-independent BLOB stream pipeline and a built-in encryption contributor for encrypting BLOBs at rest. It also adds
IByteArrayEncryptionServicetoVolo.Abp.Securityfor authenticated encryption of binary data and streams.Previously, BLOB content flowed directly between
IBlobContainerandIBlobProvider. Applications that needed encryption, compression, validation, virus scanning, or similar content transformations had to replace the container/provider or add provider-specific implementations. The new pipeline provides a reusable interception point above all storage providers, so the existing provider packages do not require any changes.BLOB pipeline
IBlobPipelineContributorwithOnSaveAsyncandOnGetAsyncstream transformation hooks.PipelineContributorsconfiguration.Authenticated binary encryption
IByteArrayEncryptionServicewith byte-array and stream APIs.AbpByteArrayEncryptionOptions.Built-in BLOB encryption
UseEncryption()for enabling encryption on an individual container or on the default container configuration.BlobEncryptionContributor,IBlobEncryptionService, andIBlobEncryptionKeyProvider.UseEncryption(...).Abp.BlobStoring.Encryption.TenantPassPhrasesetting.AbpBlobStoringEncryptionOptions.DefaultPassPhrase.IBlobEncryptionKeyProviderwith a vault/KMS-backed implementation.ABPEmagic header and a format version.Usage
Enable encryption for a specific container:
Enable encryption for all containers by default:
Set a tenant-specific passphrase:
Create and register a custom pipeline contributor:
In this example, the BLOB is compressed and then encrypted during save; it is decrypted and then decompressed during read.
Compatibility and operational notes
ABPEheader pass through unchanged.Documentation
Checklist
How to test it?
Automated verification completed:
Results:
Volo.Abp.Security.Tests: 24 passed.Volo.Abp.BlobStoring.Tests: 29 passed.netstandard2.0,netstandard2.1,net8.0,net9.0, andnet10.0.The automated coverage includes:
IBlobContainer.Manual smoke test:
UseEncryption()for a test container and provide a passphrase.IBlobContainer.ABPEand do not contain the plaintext payload.IBlobContainerand verify that the original content is returned.