Skip to content

Dart socket network policy should support upgrades to secure socket #43223

@mehmetf

Description

@mehmetf

There are rare use cases for this. Quoting @sortie:

As I said, e.g. you need to connect to some fixed IP (maybe some localhost port, or you needed to resolve the hostname ahead of time to make sure it does not resolve to the local network if you don't trust the hostname, for security reasons, this is done in pub.dev e.g.) but connect as if you are connecting to a given secure hostname. Those situations are rare but legitimate and I was thinking we could probably get away with this policy without needing to frontload solving that problem.

One use case cropped up in grpc package. In here, the client is trying to upgrade a socket to SecureSocket via an authority host. Two options come to mind to support it:

  • Support another API for SecureSocket.connect which accepts an authority host in addition to destination host/port and bypasses Socket.connect.

  • Support insecure socket upgrade properly. This might involve poisoning the Socket instance such that no data exchange is allowed until TLS handshake is started. I am not sure how difficult this would be. Handshake immediately calls _detachRaw().

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-io

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions