Repository navigation
fix(containment): measure the module folders pwsh loads in WritableRoots - #62
Merged
Merged
Conversation
pwsh puts the account's own module folder ahead of every folder a launcher names, and the verifier's later commands auto-load modules from it, but WritableRoots measured only its escape set (the S-18 follow-up, brief 12). - Get-ModuleSearchSet names every entry of the verifier's own PSModulePath, the Modules folder of $PSHOME, and the folders of both powershell.config.json files, with each file that exists. - Test-WritableRoot fails a writable module or configuration place even inside a declared root; the six escape entries keep their exemption. - Measure-EscapePath judges a place that does not exist by its nearest existing ancestor: writable with the right to add a folder there, closed below a file, unmeasured when nothing on its path exists. - A relative, network or device entry is reported unmeasured, never opened. - Every path and reason in the evidence is relayed through Format-RelayedText, 200 characters each and 1,000 per list (part of R11-01). Tests first: 34 of 124 red for the stated reason, then the 29-row relay table red before any relay. 34 mutants caught on copies outside the working tree. ContainmentVerifier suites: 1,094 passed, 0 failed, 3 skipped. The verifier digest becomes 2cea2d64...aab8c3; containment profiles re-pin it. Co-authored-by: AI Assistant <ai@example.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tableRoots The review of 0b7e4ab asked for changes (R12-01 to R12-07). Fixed as the controller ruled under the owner's delegation: - R12-01: a place of the module search set counts as writable while this identity can replace it: on Windows by DELETE on it, which the kernel also grants through FILE_DELETE_CHILD on the folder that holds it; elsewhere by write access to that folder, so a run off Windows is not made unmeasured. The remedy, gaps 1 and 3, docs/SECURITY-REVIEW.md and the CHANGELOG take the reviewer's wording, and the remedy also removes FILE_DELETE_CHILD and DELETE for the identity on Documents. The six escape entries are unchanged. - R12-02: on Windows the set also names Documents\WindowsPowerShell\Modules and %ProgramFiles%\WindowsPowerShell\Modules, resolved without verifying that they exist. The guard's own exposure under Windows PowerShell 5.1 stays open for brief 18, and the README, the review entry, the S-18 rows and the CHANGELOG say so. - R12-03: start the folders empty or re-own an existing tree recursively; only each place is judged, not the modules inside it. - R12-04: a file above an absent place counts as writable when this identity can delete it, for every entry. - R12-05: a profile path without a folder part throws too, and a throw of the set leaves WritableRoots Unavailable with the reason relayed, so the run gets its report. - R12-06: four wordings (USERPROFILE, a link on the way to a share, how a link is measured, "until it closes them"). - R12-07: rows for a padded entry and a trailing dot; the separator follows the platform the check measures, so both separators are pinned on every leg. - Both switch statements of Test-WritableRoot name Closed, and any other state is unmeasured. Tests first: 18 of 179 Flow and Filesystem tests failed for the stated reason, then 179 passed. Mutants on copies outside the working tree: 59, all caught, the reviewer's M11 and M12 among them; the phase 2 mutant M33 was caught after its test pinned its own reason. Every ContainmentVerifier suite: 1,118 passed, 0 failed, 3 skipped by design. PSScriptAnalyzer: 0 findings. markdownlint: 0 issues. Verifier SHA-256: 754a2f9cd8ca3225361b42ee5dd31cd0c4acd9ce441e44228abc770c0f1c7094 Co-authored-by: AI Assistant <ai@example.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The scoped re-review of 3eb5d8f found two more ways to a false Pass. Fixed as the controller ruled under the owner's delegation: - R12-08: Windows PowerShell 5.1 resolves the documents folder with verification, and when that folder does not resolve, it puts the relative WindowsPowerShell\Modules first, which resolves against its working directory. The set named the unverified absolute path instead, so a closed profile without Documents passed. On Windows a local documents folder that Directory.Exists does not find, or one that cannot be named, now names 5.1's relative entry, which Get-SearchPathProblem reports unmeasured. DoNotVerify stays, and a share stays a network entry that is never asked whether it exists. The README, docs/SECURITY-REVIEW.md and the CHANGELOG say that 5.1 searches its working directory then, that a Pass describes the state at the check, and that every hook call starts 5.1 afresh, so moving or re-pointing Documents during a run reaches the guard, which brief 18 owns. - R12-09: the remedy removes FILE_DELETE_CHILD, DELETE, WRITE_DAC and WRITE_OWNER for the identity on Documents, and has an administrator own it, because an owner holds WRITE_DAC whatever the access list says. Tests first: the row of a missing local documents folder and the case of the reviewer's false Pass failed for the stated reason, and the other 179 tests passed; then 182 of 182. Mutants on copies outside the working tree: 63 of 64 caught. The reviewer's X09 (verification instead of DoNotVerify) survives: it is now equivalent in what the set names, except for network access, which a unit test cannot show. Every ContainmentVerifier suite: 1,121 passed, 0 failed, 3 skipped by design. PSScriptAnalyzer: 0 findings. markdownlint: 0 issues. Verifier SHA-256: d7d2b02f3202954e8a6a16d010c47786572fffb403ebb02a354c51d4923bf869 Co-authored-by: AI Assistant <ai@example.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Brief 12 is done on ai/writable-roots-module-folders, stacked on brief 17's branch, not pushed. activeContext.md names it as the current focus and brief 14, then 15 and 18, as next; progress.md gains its milestone and drops the oldest one; systemPatterns.md gains the pattern that a place a later process auto-loads code from is judged whatever root covers it, and that replacement counts as writing, without a new line. Full gate on a137a19: 5,989 passed, 0 failed, 145 skipped, coverage 91.61 %, 21 tasks, 0 errors, the expected 16 warnings. Memory Bank health: 0 errors, 0 warnings. Memory Bank and secret-scan suites: 79 passed. Co-authored-by: AI Assistant <ai@example.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Off Windows the verifier judges a path below a file by the write right on the folder that holds the file (Get-ReplacementRight). The relay row 'an escape path below a file' mapped only the file, so on Ubuntu and macOS the mock answered Absent for that folder, and the row read Unavailable instead of Pass. That one case failed both CI runs of pull request #62 (43649252975 and 43649217522) on Ubuntu and macOS; Windows, which reads DELETE on the file itself, passed. Map that folder closed, as the sibling rows already do, and pin the row to both platform branches, so that a run on any system covers both. Red first: the POSIX row failed on Windows for that reason; the whole file then passed, 105 of 105. Co-authored-by: AI Assistant <ai@example.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
raandree
added a commit
that referenced
this pull request
Nov 16, 2026
Brief 19 published the stack of briefs 13, 16, 17, 12, 14, 15 and 18 as #59 to #65, each squash tree equal to its rebased tip and each pull request's CI green on Ubuntu, macOS and Windows. #62's first CI failed one relay row off Windows, a fixture gap that a test-only fix in its squash closed; the CI-platform pattern records the lesson. ~/.copilot was redeployed from bd28133. The active context moves the merged briefs to previous focuses and names the owner's remaining steps. Progress records the milestone and the newest preview, and curates the oldest milestone. Co-authored-by: AI Assistant <ai@example.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Brief 12: the
WritableRootscheck of the containment verifier nowmeasures, beside its escape set, the places PowerShell loads modules
from: every entry of the verifier's own
PSModulePath, theModulesfolder of
$PSHOME, the folders of the user's and of$PSHOME'spowershell.config.json, and on Windows the two module folders ofWindows PowerShell 5.1, including the relative one that 5.1 searches
in its working directory when the documents folder does not resolve.
it, whether a declared root covers it or not.
above it; a relative, network or device entry is reported unmeasured
without being opened.
printable ASCII and cut at 200 characters, which settles this
check's part of R11-01.
Q1 to Q4 were decided under the owner's delegation; merging this is
the owner's explicit answer. Stricter verdicts: an identity that can
write or replace its module folders fails, and one without
Documentsis unmeasured.
Validation: every behavior red first; 64 mutants on copies, 63 caught,
X09 equivalent except for network access. The full gate before the
Memory Bank commit passed 5,989 tests, 0 failed, 145 skipped, coverage
91.61 %. Review: Request changes twice (R12-01 to R12-09), then
Approve; all fixed. R12-02, the push guard's own exposure under 5.1,
goes to brief 18, which follows.
The Ubuntu and macOS legs of the new tests run here for the first
time. Verifier digest after this merge, superseded by brief 14's:
d7d2b02f3202954e8a6a16d010c47786572fffb403ebb02a354c51d4923bf869
The appender keeps brief 13's digest.
Rebased onto main unchanged, plus one test-only commit from the
publish step. The first CI run of this pull request failed one relay
row on Ubuntu and macOS: its fixture did not map the folder that
holds a file, which the verifier measures off Windows. The row now
maps that folder and runs on both platform branches on every system.
Co-authored-by: AI Assistant ai@example.com
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com