mirror of https://github.com/raandree/NTFSSecurity
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 KiB
14 KiB
status: current
last-verified: 2026-10-20
owner: software-engineer
source: Handoff 5 (the coverage unknowns), the rc8 fix, and the tests-only round: probes, red and green runs, and the independent reviews
Culture-sensitive comparison (
A swallowed initialization error (
Debugging insights
Recurring defect classes and how to find them. Evidence is in
Tests/Coverage/Quality-Gate-Unknowns-2026-10-10.md; a fix needs a test that
fails without it (Decision 16).
Culture-sensitive comparison (tr-TR)
- With
tr-TR,Iandiare different letters, so a comparison that takes the culture of the thread drops or misses items:ToLowerorToUpper,Compare,StartsWith,EndsWith, orIndexOf(string)without aStringComparison, a case-insensitiveRegex, aWildcardPatternwithoutCultureInvariant(string.Equals(a, b)and==are ordinal and safe). Handoff 5 found two defects of this class:IdentityReference2.Equals(object)called with a name, which lowercased both sides (nowOrdinalIgnoreCase), andGet-ChildItem2 -Filter(index*did not listIndex.txt). - A scan of the C# is not enough: AlphaFS 2.2 builds a culture-sensitive regex
from a search pattern.
Get-ChildItem2therefore enumerates underInvariantCultureScope(around the creation of the enumerator and eachMoveNext, never across aWriteObject) and its ownWildcardPatternhasCultureInvariant. Check any new library call that takes a user pattern. - PowerShell
-eq,-contains, and-indo not take the thread culture; only the .NET method call failed. Probe a claim before it enters the changelog or a report (the first wording named-eqand was wrong). - A test sets the culture of the thread, restores it in
finally, names the rows that differ (index*,*.INI), keeps a control (INDEX*), reads the culture in the next pipeline stage for each item and once after the call (a cmdlet that does not restore it, or writes an item inside the scope, fails both: two mutations proved it), and is proved red on the previous build and green on the new one in all four configurations (Tests/ItemCmdlets.Tests.ps1,Tests/ObjectApis.Tests.ps1). - The argument completers of rc9 had the same flaw (
WildcardPatternwithIgnoreCaseonly:THISFOLDERO<Tab>found nothing undertr-TR); the second review found it, not the scan. A Turkish test word must put a capitalIagainst a lowercaseiof the name:NOPROPAGATEINHfaces the capitalIofInheritand passes without the fix, so prove every row red first.
A test oracle that is wrong on a domain member
Get-Acl -Auditreads the SACL with the other sections and reports an item without audit entries as protected (Windows Server 2019, 2022, and 2025 domain members, Windows 11); the module andGet-NTFSInheritanceread the SACL alone. Tests read the flag with .NETGetAccessControl(Audit)(Get-TestAuditAcl). A suite that is green on the host proves nothing about an oracle: run a new test on a domain member before calling it done.
A piped property and the parameter set
- An object with a property
AppliesTo, piped intoAdd-orRemove-NTFSAccessor-NTFSAuditwith a path, bound the defaultPathComplexset and lost the property. Fixed in93ed2c7: the four cmdlets declare no default set, so the property selectsPathSimple, an object withAppliesToandInheritanceFlagsfails withAmbiguousParameterSet, and the tests pipe an object of each shape (red on the previous build, green on the new one). A probe that tells the sets uses an entry of the default scope: removingThisFolderOnlyfrom it leaves theInheritOnlypart. - PowerShell restores only the parameters that the previous piped object
bound. A field that the cmdlet writes itself stays for the next object: the
scope that
ProcessRecordconverted fromAppliesTointo the field behind-InheritanceFlagswent to the next object without a scope.93ed2c7shipped that, the third review found it (rc7 had it for piped-SecurityDescriptorobjects), and9783d2akeeps the flags of a record in locals. A pipeline test pipes two or more objects of different shape in one call (Objects with different scopes in one pipeline, both ParameterSets files); one object per call cannot see it. - Probe the route that the documentation shows.
Import-Csvof a file gives an empty string for a blank cell,ConvertFrom-Csvof strings gives$nullfor a trailing blank cell, andImport-Csvgives$nullfor a column that a row lacks. The binder treats them differently:$nullfails to bind, and a value that it cannot convert to the enum (an empty string, a typo) is ignored, so the object is handled as one without the property. The first statement and the first tests used the convenient route, and the reviewer found the false claim; the corrected claim was then too narrow once more (a value that converts binds, whatever its form; a flag next to an unusable value wins). Write the claim from a probe of each form, not from the one that you tried. - A sentence that says what a test proves is a claim too: a title that says "and change nothing" needs an assertion that can see the change (the audit cmdlets write the SACL, not the DACL), and "cannot go red" needs a run.
- The cause was
DefaultParameterSetName = "PathComplex": when a piped object satisfies the mandatory parameters of the default set, PowerShell settles on it and never tries a parameter that belongs to another set. A stand-alone model with the four sets and no default bindsPathSimplefor an object withAppliesTo,PathComplexfor one without, and an error for one withAppliesToandInheritanceFlags(probes\p-parameterset-binding*.ps1in the Handoff 5 evidence; the model bindsPathComplexfor a piped descriptor where the real cmdlets bindSDSimple); the real cmdlets agreed for paths (probes\p-proto-appliesto.ps1). The default dated from 4.2.6, whenAppliesTowas optional;4b1abc9made it mandatory in the Simple sets, so the default no longer decided a named call. Build a model of the parameter sets before you change an attribute, and test the real cmdlet afterwards.
A swallowed initialization error (catch { })
Win32.GetEffectiveAccessran the start of the authorization manager inside an outercatch { }. A refusal there gave no exception and no rights, so the cmdlet wrote an entry withSynchronizeonly (.NET adds it to every allow rule) and no error: a false "no access". The security review of the matrix found it (LOW); rc8 fixed it (25fe775) with onetry/catchthat records every exception inauthzException.- A trigger without a test seam:
Get-NTFSEffectiveAccess -ServerName ('a' * 40000).AuthzInitializeRemoteResourceManagerfails with error 14 for a name of 32,718 characters or more, and with 1722 (RPC server unavailable, which keeps the documented fallback and its warning) for a shorter one. Server 2019, 2022, 2025, and Windows 11 26H1 agree (a probe in the rc8 record). Bisect the length of an input before you add a seam. - The test accepts both outcomes (an error, or the result of this computer) and
fails for no access without an error: the red run said
Expected FullControl, but got Synchronize. A system-dependent boundary must not fail the test where a system answers like for a short name. - The review found a second flaw in the same output: the warning "the result is
based on this computer" came before an error that left no result. A warning
that qualifies a result belongs with the result (
!FromRemote && !OperationFailed); the tests assert its absence next to the error. - A word in the CHANGELOG is a claim: "an overlong name" suggested 256 characters, where 1722 still falls back. The entry names the probed length.
A helper that waits for a child that never started
- The helper that ran a test file in the four CI configurations passed the
Pester name filter to the basic-user run through
runas /trustlevel:0x20000 "…". A filter with spaces (*treat a path with brackets*) broke the nested quotes, the child never started, and the helper waited for its whole timeout (30 minutes). An implementer blamed the load of four agents at once; a call alone with the same spaced filter showed the helper. - The filter now travels as base64 (
-FullNameBase64), and a basic-user run gives up after 60 seconds when its runner never started (about 6 seconds normally). Before you blame the load for a stall, repeat the call alone with the same arguments.
Optional enum parameters that take pipeline input by property name
- The binder skips a piped property that it cannot convert to the type of an
OPTIONAL parameter and keeps the default: a typo for
Deny, a blank CSV cell, or a misspelled scope silently made an Allow entry or the default scope (probep-unconvertible-optional-params.ps1on rc8, both editions; a named call fails loudly; one parameter set with optional parameters does not help).Get-FileHash2 -Algorithmhas the same flaw and stays a known limit. - Decision 27, fix B: the five parameters of the four add and remove cmdlets
are
object, converted in the cmdlet byParameterConversion. All five must beobject: withAppliesToalone, a row withAppliesToand flags lost itsAmbiguousParameterSet. The price was found by the review, not by the author's tests: a$null, DBNull, or blank value of the OTHER group binds too (a CSV with columns of both groups isAmbiguousParameterSet); a named$nullbinds, where rc8 refused it (MyInvocation.BoundParametersshows it inBeginProcessing); a script block is no longer delay-bound; the completion of the names has to be rebuilt (quotes, wildcards, declaration order); help showsObject. Probe every form of a value before you write a claim, and ask a reviewer for the negative space. - PowerShell accepts a comma list or an array for an enumeration that is not
[Flags]and combines the numbers bit by bit (a logical or):-AppliesTo 'ThisFolderOnly,FilesOnly'made aFilesOnlyentry and-AccessType 'Allow,Deny'aDenyentry (4.2.6 and rc8 alike). The conversion rejects a list for such an enumeration, in whatever kind of collection it comes; a single name and a one-element collection stay valid. A matrix of valid shapes, run on the published build and on the new one, showed that exactly the 9 list rows changed. Code that opens a one-element collection needs a depth limit: an array that holds itself hung the first version (the binder of rc8 ends the host with a stack overflow on it), so the conversion opens at most 32 levels and reads at most two elements. The three flags parameters still hand such a collection to PowerShell's own conversion, which ends the host with a stack overflow, as in rc8; not fixed (no real input builds one, and a test would end the Pester process too). - The message of a bad value is built inside a catch block, and a formatter
there must not throw:
DescribecalledToStringof the one element outside a guard, so an element whoseToStringthrows (a script method) ended a piped command with anExtendedTypeSystemExceptioninstead of one error for that item (found by the last delta check of the second review; the version before named a collection by its type and never formatted an element). Wrap the whole formatter and fall back to the type name, in the short form (Type.ToString;FullNamespells out the assembly of every generic argument). A test that pins a limit (ten elements named, two elements read) is green on the code that it guards: prove it with a mutant of the limit (no limit: 4 rows red; a limit of nine: 6 rows red). - A loop that stops early runs
Disposeof the enumerator, andDisposecan fail: the catch ofTakeOneValuereturned the collection to PowerShell's conversion, which combines a list bit by bit, so a sequence whose enumerator throws inDisposelet a list through. The first patch (isList = count > 1in the catch) fixed the reported shape (two elements) and left its sibling (one element that holds a comma list); the closing check found it. Fix the root: read with an explicit enumerator and release it in its own guard, so that a failing release never changes what was read. The test needs a compiled stand-in (Add-Type, asPipelineControl.Tests.ps1does); no built-in enumerator fails inDispose. - PowerShell calls the getter of a by-property-name parameter once per
command, when a piped object first binds it (
p-getter-calls.ps1). A test that must visit it pipes an object that has the property. A property getter that throws reads as$nullwithout a trace: test it through reflection.
A differential oracle that covers part of the input
- The matcher of
Get-ChildItem2 -Filterwas checked against Windows PowerShell 5.1 over 55,987 patterns, on 8.3-compliant names only, so that the short name is the real name. Such names have at most one dot, where the first and the last dot are the same, so a rule about the LAST dot was invisible:*.??droppedarchive.tar.gz. The review found it with 849k pairs. Cover every dimension of the input, and neutralize a quirk of the oracle instead of avoiding the inputs that trigger it:fsutil file setshortnamegives a long name a short name that matches nothing,fsutil 8dot3name stripremoves it. - A very long pattern ended the host with a stack overflow (recursion depth =
tokens): bound the input of a recursive matcher (
ValidateLength).
Agents in parallel worktrees
git stashis ONE list for all worktrees: apoptakes the top entry of whoever created it and moved the edits of one agent into another's tree. The brief forbids stash,restore,reset,clean, and checkout of a sha; a RED run on the unchanged product uses a private base worktree. Protect a foreign stash withgit update-refbefore anything else.- An agent that ends its turn without a report may have done nothing (a clean worktree and an empty probe folder said so): write to it and ask.
- Help generation:
Update-MarkdownHelpreadsPositionfrom the help file that the build copies, not from the C# attribute, so a page edit alone drifts: edit the page,New-ExternalHelp, rebuild, then check the docs (the files are a fixpoint). A pair of asterisks in one paragraph loses them in the XML.