Harden advanced settings deserialization [2/4] - #404
Open
andrewiethoff wants to merge 2 commits into
Open
Conversation
This was referenced Jul 31, 2026
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.
Merge order: 2 of 4
Depends on
dotnet10-update(#403). Independent of #405 — the two are sibling branches offdotnet10-updateand neither contains the other, so they may be merged in either order.dotnet10-updatesecurity-auditfeat/accuraterip-meta-implementationfix/net10-build-output-and-assembly-resolutionWhat this does
The advanced settings block is persisted as JSON with
TypeNameHandling.Auto, which means the$typediscriminators in the stored settings decide which CLR types get instantiated on load. Without a binder, anyone able to write to the settings file can name an arbitrary type and have it constructed during deserialization.This adds an allow-list
ISerializationBinder(AudioSettingsSerializationBinder) and applies it to both the save and the load path inCUEConfig. The allow-list is derived at runtime from the encoder and decoder settings types that a defaultCUEConfigAdvancedactually registers, so it stays correct as codecs are added or removed rather than being a hand-maintained list. Anything outside it is rejected with aJsonSerializationExceptionin both directions.Scope
3 files, +198 / −21.
CUETools.Processor/CUEConfig.cs— the binder plus its use inSaveandLoadCUETools/CUETools.TestProcessor/CUEConfigSecurityTest.cs— new tests:LoadRejectsUntrustedJsonTypeNamesandSaveAndLoadAllowsRegisteredJsonTypeNamesCUETools/CUETools.TestProcessor/CUETools.TestProcessor.csproj— registers the new test fileNote on reviewing this stack
All four PRs target
master, because a cross-fork pull request can only target a branch that exists in this repository. Until #403 merges, this diff also contains its commit.