-
Notifications
You must be signed in to change notification settings - Fork 8.1k
WebCmdlets check if absolute uri before checking scheme #19468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
|
Please add new test. |
| $command = "Invoke-WebRequest -Uri '$uri' -SkipCertificateCheck" | ||
|
|
||
| $result = ExecuteWebCommand -command $command | ||
| $result.Error.FullyQualifiedErrorId | Should -Be "WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before the fix was it "InsecureRedirection" exception? Could you please explain why now it is WebCmdletWebResponseException?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I introduced "InsecureRedirection" exception in #18595, previously it was WebCmdletWebResponseException.
If the uri has no scheme checking for a scheme would throw an error, so we skip the check and we go back to the old error on https to http redirection
...t.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs
Outdated
Show resolved
Hide resolved
daxian-dbw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue author has confirmed the fix solves the issue for his scenarios: #19461 (comment)
@CarloToso please update the comment as we discussed in #19468 (comment) and then I will merge the PR. Thanks!
|
@daxian-dbw done |
|
🎉 Handy links: |
PR Summary
History:
-AllowInsecureRedirectto follow the redirect anyway Add AllowInsecureRedirect switch to Web cmdlets #18546-AllowInsecureRedirectWebcmdlets display an error on https to http redirect #18595PR Context
Fix #19461
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).