Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

@SteveL-MSFTSteveL-MSFT commented Aug 3, 2021

PR Summary

A change was made previously to support shebang on Linux to accept files without requiring .ps1 extension. However, Windows doesn't support shebang, so we should be consistent with Windows PowerShell and only allow for scripts with .ps1 extension.

Fix is to update consolehost -File parsing path to check if the file has a .ps1 extension on Windows and return an error.
A bunch of tests had to be updated with the new behavior.

PR Checklist

@iSazonoviSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Aug 3, 2021
@SteveL-MSFT
Copy link
MemberAuthor

static analysis failures are not related to this PR, still not sure why those URLs fail in CI but work locally from my dev machine unless CI is using a proxy for internet.

@ghostghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Aug 3, 2021
…eterParser.cs Co-authored-by: Paul Higinbotham <paulhi@microsoft.com>
@ghostghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Aug 3, 2021
@SteveL-MSFT
Copy link
MemberAuthor

SteveL-MSFT commented Aug 3, 2021

Don't know why codeql is failing as it's complaining about --print-diagnostics-summary being an invalid switch, but it's clearly supported via https://codeql.github.com/docs/codeql-cli/manual/database-interpret-results/

@TravisEz13TravisEz13 added the WG-Security security related areas such as JEA label Aug 3, 2021
@TravisEz13TravisEz13 changed the title Only allow -File to accept .ps1 scripts on WindowsOnly allow -File to accept .ps1 scripts on WindowsAug 3, 2021
@TravisEz13TravisEz13 merged commit 6933c5b into PowerShell:masterAug 3, 2021
@SteveL-MSFTSteveL-MSFT deleted the file-ps1 branch August 6, 2021 20:02
@ghost
Copy link

🎉v7.2.0-preview.9 has been released which incorporates this pull request.:tada:

Handy links:

@ghost
Copy link

🎉v7.2.0-preview.10 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-GeneralIndicates that a PR should be marked as a general cmdlet change in the Change LogWG-Securitysecurity related areas such as JEA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@SteveL-MSFT@rjmholt@TravisEz13@PaulHigin@iSazonov@adityapatwardhan