Skip to content

AIOHTTPTransport ssl=False by default #529

Closed

Description

@mariuskava

Common problems

  • TLS should be enabled by default. AIOHTTPTransport uses ssl=False by default
  • I was expecting library to fail when using self signed certificate on the server.

To Reproduce

  • start a server with a self signed certificate
  • try connect
  • it will succeed instead of failing

Expected behavior
Expect connection to fail when using not trusted certificates

System info (please complete the following information):

  • Any

Activity

  1. leszekhanusz commented on Feb 17, 2025

    @leszekhanusz
    Collaborator

    That's pretty bad... Thanks for your report.

    The annoying thing is that there are probably some people which are depending on this and changing the default will be a breaking change for them.

    A major version bump will be needed to fix this.

  2. added
    type: bug
    on Feb 17, 2025
  3. mariuskava commented on Feb 17, 2025

    @mariuskava
    Author

    yes, there must be a breaking change.. but a patch release could contain a warning:

    • default should be changed to ssl=None
    • if ssl==None: log warning and set ssl=False
  4. leszekhanusz commented on Feb 17, 2025

    @leszekhanusz
    Collaborator

    yes, there must be a breaking change.. but a patch release could contain a warning:

    Good idea!

  5. leszekhanusz commented on Feb 18, 2025

    @leszekhanusz
    Collaborator

    Note that for the warning, the default value cannot be None.

    That's because there was a change in aiohttp from version 3.10

    Before aiohttp 3.10, aiohttp was using None as the default value, and would verify the certification in that case.
    From aiohttp 3.10, it switched to use True as the default value.

    So, someone could have used ssl=None previously with AIOHTTPTransport. He would have a typing error with mypy but it would work and gql would verify the certificate. If we set ssl to False if we receive None, then gql will not verify the cert for him in that case.

    We could use another default value, like the "warning" string?

  6. mariuskava commented on Feb 18, 2025

    @mariuskava
    Author

    good point. Default string value sounds good enough or it could be a predefined sentinel = object()
    https://python-patterns.guide/python/sentinel-object/#sentinel-objects

  7. leszekhanusz commented on Aug 17, 2025

    @leszekhanusz
    Collaborator

    Fixed in version 4.0.0

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

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions