Use native PowerShell on Windows - #1848
Merged
Merged
Conversation
Aaronontheweb
enabled auto-merge (squash)
August 10, 2026 09:58
Comment on lines
+156
to
+164
| foreach (var unit in ExtractApprovalUnitsViaAnalysis(analysis)) | ||
| { | ||
| var normalized = ShellTokenizer.NormalizeApprovalUnit(unit, workingDirectory); | ||
| var normalized = ShellTokenizer.NormalizeApprovalUnit( | ||
| unit, | ||
| workingDirectory, | ||
| Environment.PathStyle); | ||
| if (!string.IsNullOrEmpty(normalized)) | ||
| patterns.Add(normalized); | ||
| }); | ||
| } |
Comment on lines
+126
to
+134
| catch (Exception ex) | ||
| { | ||
| ReportCompletion( | ||
| BackgroundJobStatus.Failed, | ||
| -1, | ||
| $"Failed to start shell '{_environment.ExecutableName}' " | ||
| + $"at '{_environment.ExecutablePath}': {ex.Message}"); | ||
| return; | ||
| } |
Comment on lines
+45
to
+49
| var executablePath = Path.Combine( | ||
| systemDirectory, | ||
| "WindowsPowerShell", | ||
| "v1.0", | ||
| "powershell.exe"); |
| break; | ||
| } | ||
| { | ||
| var linkDir = Path.Combine(scratch, "link"); |
| // Lexically this path lives in scratch/link, outside any | ||
| // denied root — only segment-walk symlink resolution | ||
| // catches it. | ||
| viaLink = Path.Combine(linkDir, "netclaw.json"); |
| // linkA -> linkB -> deniedDir. A resolver that only | ||
| // follows one hop would stop at linkB; the walk must | ||
| // reach the final real target. | ||
| var linkB = Path.Combine(scratch, "linkB"); |
| // follows one hop would stop at linkB; the walk must | ||
| // reach the final real target. | ||
| var linkB = Path.Combine(scratch, "linkB"); | ||
| var linkA = Path.Combine(scratch, "linkA"); |
| createdLinks.Add(linkB); | ||
| createdLinks.Add(linkA); | ||
|
|
||
| viaLink = Path.Combine(linkA, "netclaw.json"); |
Aaronontheweb
commented
Aug 10, 2026
| [InlineData(@"Remove-Item -LiteralPath FileSystem::C:\ -R -Confirm:$false")] | ||
| [InlineData(@"Remove-Item -Path:C:\ -Recurse")] | ||
| [InlineData(@"ri C:\ -Recurse")] | ||
| public void Native_power_shell_denies_recursive_root_removal_without_force(string command) |
Collaborator
Author
There was a problem hiding this comment.
This and the test below it are going to need to be revisited from a safety perspective
This was referenced Aug 10, 2026
Merged
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
Security
Evidence
OpenSpec
Change:
native-windows-powershell-hostThree tasks remain. Windows CI must supply native host evidence. The final flow must merge, verify, sync, and archive the change.