Skip to content

Add GuidFormats option to ScrubInlineGuids - #1825

Merged
SimonCropp merged 2 commits into
mainfrom
scrub-inline-guids-formats
Jul 31, 2026
Merged

Add GuidFormats option to ScrubInlineGuids#1825
SimonCropp merged 2 commits into
mainfrom
scrub-inline-guids-formats

Conversation

@SimonCropp

@SimonCropp SimonCropp commented Jul 31, 2026

Copy link
Copy Markdown
Member

Fixes #1822

Problem

ScrubInlineGuids matches both D format (00000000-0000-0000-0000-000000000000) and N format (00000000000000000000000000000000) guids. Since any 32 character hex sequence is a valid N format guid, hex content of that exact length (an MD5 hash for example) is also scrubbed. There was no way to opt out of N matching while keeping D.

Change

Add a GuidFormats flags enum and new ScrubInlineGuids overloads that accept it:

// Only scrub dashed "D" format guids; 32 char hex hashes are left untouched
.ScrubInlineGuids(GuidFormats.Dashed)
  • GuidFormats = Dashed (the D format, which also covers B/P) | Undashed (the N format) | All.
  • The existing parameterless / extension-only signatures are left untouched; the format selection is exposed as added overloads rather than an optional parameter, so this is not a binary breaking change (an optional parameter would change the existing method signatures and break callers compiled against them with MissingMethodException).
  • Applied consistently across all entry points: instance / global × plain / extension-mapped, plus the fluent SettingsTask wrappers. A shared GuidMatcher.ForFormats helper preserves the existing D-then-N scrubber order, and the original methods now delegate to GuidFormats.All.

Tests & docs

  • Added tests proving GuidFormats.Dashed leaves an N format hash untouched, and GuidFormats.Undashed leaves a D format guid untouched.
  • Documented the new option in docs/mdsource/guids.source.md and regenerated docs/guids.md.

ScrubInlineGuids matches both D and N format guids. Since any 32 character
hex sequence (an MD5 hash for example) is a valid N format guid, that
content is scrubbed too.

Add a GuidFormats flags enum (Dashed, Undashed, All) and an optional
formats parameter (defaulting to All) to all ScrubInlineGuids overloads,
so scrubbing can be limited to specific formats.

Fixes #1822
Adding an optional parameter to the existing ScrubInlineGuids methods
changed their signatures, which is a binary breaking change: an assembly
compiled against the old parameterless signature would fail with
MissingMethodException at runtime, since optional arguments are baked in
at the call site.

Keep every original signature untouched and add sibling overloads that
take GuidFormats.
@SimonCropp SimonCropp added this to the 31.28.0 milestone Jul 31, 2026
@SimonCropp
SimonCropp merged commit 403e116 into main Jul 31, 2026
7 checks passed
@SimonCropp
SimonCropp deleted the scrub-inline-guids-formats branch July 31, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Option to not scrub N instance Guids

1 participant