Repository navigation
Preserve exact isolated process environment literals - #954
Merged
Merged
Conversation
Signed-off-by: Colin Neilens <coneilen@microsoft.com> Co-authored-by: Copilot App <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.
Summary
Add a narrowly scoped helper for isolated PowerShell entry points to reassert the exact reviewed
PATHEXTandPSModulePathProcess literals after startup, without relaxing the full 30-key environment guard. This standalone change does not wire or invoke inventory entry points.Changes
1aa30100d4f38e4617e22ca1c0332c3a68afa093. No inherited UIA/Delete/Wire source hunks, inventory copies, readiness rebinding, or metadata-policy changes.The helper is byte-identical to reviewed SHA-256
26CC557B22B302488AC68151FBEC10A200F4A1FD2F7798F1EB03FB7E8DB80270. One tightly coupled test-fixture correction was necessary: start synthetic PATH with PSHOME before System32, avoiding unrelated PowerShell startup PATH reordering. The original GREEN failure and key-only PATH diagnostic are retained. Reversing only that ordering restores the exact reviewed test SHA-256C819290E7D179B9E444770E46BAB6C600EC91FC709F562C40CC0A888FBCE61F1; the helper and strict guard were not changed.Test plan
RED: & 'C:\Program Files\PowerShell\7\pwsh.exe' -NoProfile -File Tools\windows\Tests\IsolatedProcessEnvironment.Contracts.Tests.ps1 -Phase RED -> 1 case; actual exit 1; fresh-pwsh startupDrift=true and exact ISOLATED_ENV_LITERAL refusal without reassertion
GREEN: & 'C:\Program Files\PowerShell\7\pwsh.exe' -NoProfile -File Tools\windows\Tests\IsolatedProcessEnvironment.Contracts.Tests.ps1 -Phase GREEN -> 1 case passed; actual exit 0; startup drift observed and complete strict guard passed
REGRESSION: & 'C:\Program Files\PowerShell\7\pwsh.exe' -NoProfile -File Tools\windows\Tests\IsolatedProcessEnvironment.Contracts.Tests.ps1 -Phase REGRESSION -> 14 cases passed; actual exit 0; all required refusal categories and unchanged parent literals asserted
Chronology: reviewed implementation sources existed before these behavioral runs. RED is an actual fresh-process reproduction of the missing-initializer boundary, not a claim that implementation followed test-first development.
& 'C:\Program Files\PowerShell\7\pwsh.exe' -NoProfile -File Tools\windows\Tests\UiCaptureDriver.Tests.ps1 -PrepareFixturesOnly -ScratchRoot C:\gceb78f7\prebuilt-v1& 'C:\Program Files\PowerShell\7\pwsh.exe' -NoProfile -File Tools\windows\Tests\UiCaptureDriver.Tests.ps1 -ScratchRoot C:\gceb78f7\capture-v1 -PrebuiltFixtureManifest C:\gceb78f7\prebuilt-v1\fixtures.json -PrebuiltFixtureManifestSha256 FC1B9F7AB69A619F748E2D6E83D1F4D52154F5CB1081D0CB5B790E37ADAC0419& 'C:\Program Files\PowerShell\7\pwsh.exe' -NoProfile -File Tools\windows\Tests\ValidationRunner.Tests.ps1& 'C:\Program Files\PowerShell\7\pwsh.exe' -NoProfile -File Tools\windows\validate.ps1 -Task hardening& 'C:\Program Files\PowerShell\7\pwsh.exe' -NoProfile -File Tools\tdd\Tests\TddEvidence.Tests.ps1Parser.ParseFileon helper, focused contract and ValidationRunnergit diff --checkFocused cases cover baseline/green, missing and empty approved literals, missing other expected literal, extra key, other-key drift, post-reassertion mutation, wrong entry path, and refused User/Machine/Host target parameters. Passing GREEN uses the strict full-map guard, preserving the other 28 literal values and permitting no extra keys. An additional fresh regression run confirmed the whole parent Process map (138 keys) remained unchanged; dot-sourcing also left that map unchanged. Static helper inspection found exactly two setters and four environment API sites, all explicit Process scope. User/Machine values were neither read nor snapshotted; persistent-scope non-mutation is source/scope evidence, not a runtime registry comparison.
Recovery granted the exclusive serialized native/resource lease for the full suites and the separately authorized fixture-preparation stage; they ran sequentially. The first unbound full-suite attempt is retained as a setup failure, exit 1, executed 1/passed 0/failed 1/skipped 0,
PrebuiltFixtureRequired; it is not native-behavior evidence. Fixture source/tool/file bindings were independently checked before the subsequent run; the parent's additional independent verification arrived after launch and before continuation. Compiler raw EOF remains unproven in provenance snapshots; this is not represented as complete compile-stream capture.Raw streams, synthetic maps, first failures and replay checks remain in the owned worktree
.build\environment-boundary-evidence/.build\isolated-process-environmentand short ownedC:\gceb78f7roots. The passing full suites retain injected selector/denied-path diagnostics rather than suppressing them. Suite held-handle/job/EOF cleanup assertions passed; a separate advisory process scan observed 345 processes with 0 owned-root survivors, not authority to terminate processes. No full default-profile snapshot is claimed.Exact-head CI history: run
41113548037, attempt 1, Windows 2025 job124261920850failed with UiCaptureDriver 180/182 (2 failures, 0 skips); helper regression 14 passed. The primary case wasmatched S tab actual worker seed write preserves scene path and not-created cleanup: the live held PID 8544's first CIM observation was Incomplete at19:23:06.4773810Z, triggering guarded rollback; a later observation contained creation/image metadata and guarded Stop followed. The existing fixture's finally block masked the original launch refusal with its cleanup assertion because no run had returned. Its default false EOF/root flags prove neither a leak nor completed cleanup. The report-gate failure was dependent on that failed case. The primary exception text did not survive masking; unchanged capture module/test/worker sources were not edited.After preserving attempt 1 log/artifact
13005916886and independently reviewing its trace, exactly one targeted rerun of the failed job was authorized at the same head4e1e70de789880a0e74b403c0ad52254300dec2e, with no source changes. Run41113548037, attempt 2, actual Windows 2025 job124271394331passed: helper regression 14, UiCaptureDriver 182/182 with 0 failed/0 skipped, full ValidationRunner PASS, and deterministic hardening repeated-runs 3/3. The carried Windows 2022 success retains its original execution timestamps; it is not claimed as a second Windows 2022 execution. First-failure and successful-rerun logs, the nonempty 32-event primary trace, and the original diagnostic artifact remain retained underC:\gceb78f7. This supports a transient unchanged-platform CIM acquisition failure, not a source correction or weakened guard. Required checks are rechecked after this evidence-only body edit before merge; path-skipped checks are not runtime evidence.Local limits: no macOS
make test/make check, product UI walkthrough, visual parity, physical input, screen-reader campaign, inventory/closed-audit invocation, product build, or packaging scheduler/PATH operations. Required hosted CI separately ran its configured Windows validation jobs. Inventory remains held after merge until a fresh pinned compile/inventory plan is independently reviewed.Checklist
git commit -s) per the DCOmake test)make check)