-
Notifications
You must be signed in to change notification settings - Fork 524
[Client encryption]: Adds a new override through property bag to enable System.Text.Json streaming API #5403
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
Merged
kirankumarkolli
merged 78 commits into
Azure:master
from
adamnova:feature/encryptionprocessor-stream-switch
Nov 4, 2025
Merged
Changes from 60 commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
c54618a
Add JsonProcessor override via RequestOptions property bag
adamnova 23749e0
Add diagnostics context and stream processor tests
adamnova 22e40d7
Refactor diagnostics scopes in decryption logic
adamnova d6b3416
Optimize stream serialization and diagnostics in encryption
adamnova 6e5884c
Refactor test encryptor setup and improve MDE fallback
adamnova 585e66c
Unify JSON processor diagnostics and add concurrency tests
adamnova 27d2593
Enforce object root for streaming encryption
adamnova 8b84c66
Enforce object root for streaming encryption
adamnova 78f0a94
Add comprehensive diagnostics scope tests for encryption
adamnova 0812ac5
Refactor MDE encryption processor with adapter pattern
adamnova 9850d4b
Refactor diagnostics scopes and add adapter tests
adamnova 752905f
[Encryption Stream] Fix provided-output decrypt tests: ensure raw enc…
adamnova c09f71f
Add tests for Newtonsoft override and change feed assertions
adamnova 9f8318b
Update diagnostics scope count assertions in tests
adamnova 459c21e
Fixed tests
adamnova 7b2170c
Update EncryptionBenchmark.cs
adamnova 5aa3de0
Cleanup
adamnova 4dcd1c8
Add experimental JSON processor configuration support
adamnova c4f6365
Update RequestOptionsOverrideHelper.cs
adamnova f11fbed
Cleanup conditional compilation
adamnova ec9b77e
Merge branch 'master' into feature/encryptionprocessor-stream-switch
adamnova 3e7ce8a
Revert
adamnova c35ffcf
Cleanup
adamnova db67e7c
Cleanup
adamnova 9496752
Changes
adamnova 7f191e9
Improved naming
adamnova 410f6ca
Refactor RequestOptions extension method usage
adamnova eb54301
Refactor decryption logic for streamlined processor selection
adamnova 4f6c466
Cleanup preview flag
adamnova 849f58e
Cleanup
adamnova 33dc1e9
Cleanup
adamnova 6ac8394
Cleanup
adamnova d5ea198
Reverted some changes and added documentation
adamnova c1cfb95
Refactor argument null checks to use ArgumentValidation
adamnova 98a5310
Standardization
adamnova 75d2684
Merge branch 'master' into feature/encryptionprocessor-stream-switch
adamnova 1dbba14
Refactor encryption processor to use adapter pattern
adamnova 565392c
Update conditional compilation for DecryptAsync methods
adamnova 2bbf6e0
Update baseline tests and API contracts for Cosmos SDK
adamnova d76440d
Update baseline test for trace writer activities
adamnova 3a4b05b
Delegate decryption to MdeEncryptionProcessor
adamnova aaba649
Revert "Delegate decryption to MdeEncryptionProcessor"
adamnova 1bb97dd
Add support for legacy decryption in EncryptionProcessor
adamnova a070536
Refactor legacy decryption path and update tests
adamnova 0d8ad47
Handle exceptions during legacy encryption detection
adamnova 43e7804
Update API contract files and baseline test data
adamnova 8e13f88
Merge branch 'master' into feature/encryptionprocessor-stream-switch
adamnova 754997c
Remove ENCRYPTION_CUSTOM_PREVIEW conditional compilation
adamnova 1c1f79c
Add NET8_0_OR_GREATER conditional compilation
adamnova e099ff0
Add experimental API and update trace baseline
adamnova e244861
Add test for unsupported JsonProcessor exception
adamnova a18b8f6
Merge branch 'master' into feature/encryptionprocessor-stream-switch
adamnova 132b6e2
Merge branch 'master' into feature/encryptionprocessor-stream-switch
adamnova 55b103b
Remove compression options from test encryption options
adamnova 1421b3e
Merge branch 'master' into feature/encryptionprocessor-stream-switch
kirankumarkolli bc7e3ef
Rename StreamAdapter and related extensions for clarity
adamnova a486d40
Refactor null checks to use ArgumentValidation.ThrowIfNull
adamnova ce197c0
Make EncryptionRequestOptionsExperimental internal and remove experim…
adamnova aeeaf0c
Inline EncryptionRequestOptionsExperimental logic and remove unused c…
adamnova 8e81b5e
Merge branch 'master' into feature/encryptionprocessor-stream-switch
adamnova 76174f9
docs: Add comprehensive PR description and Kiran's feedback tracking
adamnova 1ffd161
fix: Add defensive null check in CosmosDiagnosticsContext.Scope.Dispose
adamnova 7543e13
refactor: Remove position reset from WriteToStream method
adamnova 08c574c
docs: document Activity disposal safety in CosmosDiagnosticsContext.S…
adamnova d60f257
refactor: move startTicks capture into Scope constructor
adamnova 9010214
docs: document nested spans limitation in CosmosDiagnosticsContext
adamnova bc13a10
docs: document null owner design pattern in Scope
adamnova 376a99b
docs: document EncryptionDiagnostics design rationale
adamnova 1a4d4b8
refactor: remove obvious comments from CosmosDiagnosticsContext
adamnova e35778c
docs: Clarify nested scope limitation in CosmosDiagnosticsContext
adamnova daaa8c4
Move diagnostic scope constants to CosmosDiagnosticsContext and delet…
adamnova 40ad86a
Merge branch 'master' into feature/encryptionprocessor-stream-switch
adamnova 72891dd
Add ArgumentValidation helper methods and update CosmosDiagnosticsCon…
adamnova 2bb59d4
Refactor diagnostics context and add unit tests
adamnova 48dbdd3
Refactor: Replace manual null checks with ArgumentValidation helper +…
adamnova 7f36c6e
Add argument validation for diagnosticsContext parameter and remove n…
adamnova 0b48ae1
Add ArgumentValidation methods for range validation
adamnova 054ca11
Add unit tests for ArgumentValidation utility
adamnova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
31 changes: 31 additions & 0 deletions
31
Microsoft.Azure.Cosmos.Encryption.Custom/src/Common/StreamExtensions.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| //------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| //------------------------------------------------------------ | ||
|
|
||
| namespace Microsoft.Azure.Cosmos.Encryption.Custom | ||
| { | ||
| using System.IO; | ||
| using System.Threading.Tasks; | ||
|
|
||
| /// <summary> | ||
| /// Extension methods for Stream to provide compatibility across different .NET versions. | ||
| /// </summary> | ||
| internal static class StreamExtensions | ||
| { | ||
| /// <summary> | ||
| /// Asynchronously disposes the stream in a version-compatible way. | ||
| /// Uses DisposeAsync on .NET 8.0+ and falls back to synchronous Dispose on earlier versions. | ||
| /// </summary> | ||
| /// <param name="stream">The stream to dispose.</param> | ||
| /// <returns>A ValueTask representing the asynchronous dispose operation.</returns> | ||
| public static ValueTask DisposeCompatAsync(this Stream stream) | ||
| { | ||
| #if NET8_0_OR_GREATER | ||
| return stream.DisposeAsync(); | ||
| #else | ||
| stream.Dispose(); | ||
| return default; | ||
| #endif | ||
| } | ||
| } | ||
| } |
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
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
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
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
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
11 changes: 11 additions & 0 deletions
11
Microsoft.Azure.Cosmos.Encryption.Custom/src/Diagnostics/EncryptionDiagnostics.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| //------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| //------------------------------------------------------------ | ||
| namespace Microsoft.Azure.Cosmos.Encryption.Custom | ||
| { | ||
| internal static class EncryptionDiagnostics | ||
| { | ||
| internal const string ScopeEncryptModeSelectionPrefix = "EncryptionProcessor.Encrypt.Mde."; | ||
kirankumarkolli marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| internal const string ScopeDecryptModeSelectionPrefix = "EncryptionProcessor.Decrypt.Mde."; | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.