FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Make command searcher not use wildcard search for execution by TravisEz13 · Pull Request #9202 · PowerShell/PowerShell · GitHub

Make command searcher not use wildcard search for execution - #9202

Merged
Aditya Patwardhan (adityapatwardhan) merged 44 commits into
PowerShell:masterfrom
TravisEz13:fix_command_searcher
Apr 2, 2019
Merged

Make command searcher not use wildcard search for execution#9202
Aditya Patwardhan (adityapatwardhan) merged 44 commits into
PowerShell:masterfrom
TravisEz13:fix_command_searcher

Conversation

Travis Plunk (TravisEz13) commented Mar 22, 2019
edited
Loading

Copy link
Copy Markdown
Member

PR Summary

Make command searcher not use wildcard search for execution

PR Context

This is a Defense in Depth fix to prevent people from accidentally running a script.

For example, if a user attempted to run .\[my1].ps1 and there is a 1.ps1 in the same folder. 1.ps1 would be executed instead.
The fix allows tab completion and Get-Command to continue to work with the wildcards ([], ?, and *).

PR Checklist

Travis Plunk (TravisEz13) added Breaking-Change breaking change that may affect users CL-Engine Indicates that a PR should be marked as an engine change in the Change Log labels Mar 22, 2019

Copy link
Copy Markdown
Collaborator

If we want unambiguity, can we follow the practice we use in cmdlets? I mean that if name resolution returns several results, then throw.

/cc Michael Klement (@mklement0)

Travis Plunk (TravisEz13) commented Mar 22, 2019
edited
Loading

Copy link
Copy Markdown
Member Author

Ilya (@iSazonov) That code is already there. End the end, both code paths, use the same code. I doubt anyone actually wants to do execution based on wildcards. It can lead to executing unexpected files and VERY bad results.

Copy link
Copy Markdown
Contributor

Glad to see this is getting fixed; it addresses at least part of #4726, which also asks for the >, >> behavior to be fixed - will this PR address that too (haven't looked)?

Copy link
Copy Markdown
Member Author

Michael Klement (@mklement0) The intent was not to fix that issue. As #4726 does not directly affect execution, I would not think that the issue would be considered a Defense in Depth fix and I'd prefer to get this fix in before addressing that issue.

Copy link
Copy Markdown
Contributor

Thanks for clarifying, Travis Plunk (@TravisEz13) (but note that #4726 is about execution as well).

This comment has been minimized.

Steve Lee (SteveL-MSFT) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nit comment remaining

Comment thread build.psm1 Outdated
[string]$Title = 'PowerShell Core Tests'
[string]$Title = 'PowerShell Core Tests',
[Parameter(ParameterSetName='Wait', Mandatory=$true,
HelpMessage='Wait for the debugger to attach to powershell before pester starts. Debug builds only!')]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
HelpMessage='Wait for the debugger to attach to powershell before pester starts. Debug builds only!')]
HelpMessage='Wait for the debugger to attach to PowerShell before Pester starts. Debug builds only!')]

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Aditya Patwardhan (adityapatwardhan) merged commit 5e4b4d1 into PowerShell:master Apr 2, 2019
Travis Plunk (TravisEz13) deleted the fix_command_searcher branch April 2, 2019 18:57

Copy link
Copy Markdown
Collaborator

Should we document the command searcher process in Docs repo?

Copy link
Copy Markdown
Member Author

The command searcher itself is an implementation detail. We should document the search order for command execution.

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

Labels

Breaking-Change breaking change that may affect users CL-Engine Indicates that a PR should be marked as an engine change in the Change Log Committee-Reviewed PS-Committee has reviewed this and made a decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL