Skip to content

Pub on Windows uses SecurityContext.defaultContext which doesn't work with self signed certificates #1882

@dnfield

Description

@dnfield

This may be semi-related to #1826

When trying to install Flutter on a Windows machine that has a self-signed SSL certificate, I just get an endless loop like this:

C:\Users\dnfield>flutter doctor
Updating flutter tool...
Got TLS error trying to find package mockito at https://pub.dartlang.org.
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

On macOS with the same self signed cert, this works fine because Dart looks to the machine's Cert store - but on Windows and Linux it uses the Mozilla list (https://api.dartlang.org/dev/2.0.0-dev.50.0/dart-io/SecurityContext/defaultContext.html). I haven't checked a Linux environment and don't currently have easy access to one, but I imagine Linux users with self signed CAs would face a similar issue.

Could we get an option/environment variable/setting to allow or specify self signed certificates that are acceptable (basically using a custom SecurityContext)? I'm not 100% sure if the issue should be on pub or be on dart-sdk, but my main issue right now is with pub. I think the best solution would be to have the Dart SDK recognize self signed trusted certs in the machine store, but I'm not clear on a timeline for that and it seems like it might be easier to get pub to recognize this short term.

https://github.com/dart-lang/pub/blob/master/lib/src/source/hosted.dart#L133

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions