Skip to content

Invoke-RestMethod on a bad SSL setup crash #3588

Closed

Description

Steps to reproduce

Open Powershell. Execute:

Invoke-RestMethod https://192.168.0.173/feed

192.168.0.173 it's a local WordPress blog with SSL, though obviously configured only for my domain.

Expected behavior

Ignore the SSL error or show an error.

Actual behavior

PowerShell crashes without any clue of what happened and goes back to Bash.
sslbug

Environment data

Name Value


PSVersion 6.0.0-alpha
PSEdition Core
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 3.0.0.0
GitCommitId v6.0.0-alpha.18
CLRVersion
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

> $PSVersionTable

Activity

  1. SteveL-MSFT commented on Apr 18, 2017

    @SteveL-MSFT
    Member

    corefx uses libcurl internally on Linux. can you try the same with curl?

  2. aarroyoc commented on Apr 18, 2017

    @aarroyoc
    Author
    curl: (51) SSL: no alternative certificate subject name matches target host name '192.168.0.173'. 
    

    Tested in Bash and Powershell. It doesn't crash any of the shells unlinke Invoke-RestMethod.
    sslbug2

  3. aarroyoc commented on Apr 18, 2017

    @aarroyoc
    Author

    Maybe this title is more appropiate for the issue: "Invoke-RestMethod on a bad SSL setup crash"

  4. changed the title [-]Invoke-RestMethod on a local SSL setup crashes[/-] [+]Invoke-RestMethod on a bad SSL setup crash[/+] on Apr 18, 2017
  5. SteveL-MSFT commented on Apr 18, 2017

    @SteveL-MSFT
    Member

    adrianarroyocalle I can look into this if you can provide me instructions to setup a HTTPS endpoint on my machine that repos this

  6. aarroyoc commented on Apr 20, 2017

    @aarroyoc
    Author

    I'll try, but don't expect anything these days because I'm quite busy

  7. aarroyoc commented on May 1, 2017

    @aarroyoc
    Author

    Hi

    Doing:

    Invoke-RestMethod https://imaginbank.com
    

    also crashes PowerShell instead of giving an error. That is a public URL you can use to test.

  8. markekraus commented on Sep 21, 2017

    @markekraus
    Contributor

    This looks like it was closed by #2006 an #4026. using the -SkipCertificateCheck option with certificates that have name mismatches works now.

    Steve Lee (@SteveL-MSFT) Can we consider this one closed?

  9. SteveL-MSFT commented on Sep 21, 2017

    @SteveL-MSFT
    Member

    Mark Kraus (@markekraus) -SkipCertificateCheck makes it work, but it shouldn't crash if not used. I tried the repro on Windows and Linux (don't have Mac in my work office) and it returns an error as expected. If someone finds it still crashes on Mac, please comment here. Otherwise, I think this is closed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-FixedWG-Cmdlets

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions