Repository navigation
Honour the Hex and Base64 obfuscator encoder on either side of AddEssentials() [patch] - #152
Merged
matt-edmondson merged 1 commit intoOct 19, 2026
Conversation
…bfuscationProvider around AddEssentials() [patch] Both overloads still registered through TryAddSingleton/TryAddEnumerable, so an encoder passed after AddEssentials() was silently dropped. They now use ProviderRegistration.AddOrReplaceSingleton like the other parameterized providers, and AddObfuscationProviders() wraps them in AddDefaultOrKeep so an encoder registered before AddEssentials() survives it too. Fixes #151 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K9BPLzzCuJkUVAWjN1LtNF
|
matt-edmondson
deleted the
fix/151-hex-base64-parameterized-registration
branch
October 19, 2026 09:45
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.



Fixes #151
Problem
#136 made parameterized registrations take effect after
AddEssentials(), but it missedAddHexObfuscationProvider(encoder)andAddBase64ObfuscationProvider(encoder). Both still usedTryAddSingleton/TryAddEnumerable. As a result, onceAddEssentials()had run, the caller's encoder was dropped without any error, and data was obfuscated with the default encoder.Change
Essentials.ObfuscationProviders.Hexand.Base64: register throughProviderRegistration.AddOrReplaceSingleton<IObfuscationProvider, …>, and linkShared/ProviderRegistration.csinto both projects, the same as the Xor/Caesar/BitRotate fix. The doc remarks now describe the replace-in-place behaviour.Essentials.AllAddObfuscationProviders(): wrap Hex and Base64 inAddDefaultOrKeep<…>. Without this, an encoder registered beforeAddEssentials()would now be replaced by the default.Tests
New tests in
ParameterizedRegistrationTests:Hex_Encoder_Takes_Effect_On_Either_Side_Of_AddEssentialsBase64_Encoder_Takes_Effect_On_Either_Side_Of_AddEssentialsEach covers both call orders. It checks that the concrete type and the enumerable entry obfuscate with the caller's encoder, that the provider is listed once, and that Xor is still the default
IObfuscationProvider.With the three provider/All changes reverted, both new tests fail. With them in place, the full suite passes: 1085 tests, 0 failed. All three changed projects build clean across every target framework.
Generated by Claude Code