Skip to content

Conversation

iceweasel-oai
Copy link
Contributor

refactors command_safety files into its own package, so we can add platform-specific ones
Also creates a windows-specific of is_known_safe_command that just returns false always, since that is what happens today.

Copy link

github-actions bot commented Sep 24, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@iceweasel-oai iceweasel-oai force-pushed the iceweasel/windows-command-safety branch from 19aedc5 to 6561d4c Compare September 24, 2025 03:58
@iceweasel-oai
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Sep 24, 2025
@iceweasel-oai iceweasel-oai force-pushed the iceweasel/windows-command-safety branch 2 times, most recently from 04aaa69 to 9c2223d Compare September 24, 2025 18:44
@iceweasel-oai iceweasel-oai force-pushed the iceweasel/windows-command-safety branch from 9c2223d to 13f0876 Compare September 24, 2025 19:09
#[test]
fn everything_is_unsafe() {
for cmd in [
vec_str(&["powershell.exe", "-NoLogo", "-Command", "echo hello"]),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is a WIP, but wouldn't this be safe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this is more just meant to test the current "everything is unsafe" behavior. It'll change shortly

return true;
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is making me question whether we should be doing is_safe_to_call_with_exec() as it works today on Windows. Possibly only if you have Git Bash enabled or whatever it is on Windows and we're actually going to run the command through it? What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally had a version where only the new windows function is called and nothing after it. But there are some tests that are depending on the other safety checks being called (ie, Windows tests that use commands such as "ls"). I'm not sure if those tests are valid, but I left this for now to be conservative and not regress anything until I can learn more

Copy link
Collaborator

@bolinfest bolinfest Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ls works in PowerShell by default, apparently. It works in cmd.exe on my machine, but probably due to Git Bash.

@iceweasel-oai iceweasel-oai merged commit 0e58870 into main Sep 24, 2025
19 checks passed
@iceweasel-oai iceweasel-oai deleted the iceweasel/windows-command-safety branch September 24, 2025 21:03
@github-actions github-actions bot locked and limited conversation to collaborators Sep 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants