Skip to content

tls documentation says that checkServerIdentity function should throw an error. It should not. #11467

Closed
@lockhart-raphael

Description

  • Version: 6.7.0 - 7.5.0 (at least)
  • Platform: All? tested on MacOS / Linux
  • Subsystem: TLS

The documentation for the checkServerIdentity function at https://nodejs.org/api/tls.html#tls_tls_connect_options_callback
states that the provided function "should throw an error if verification fails. "

However, the implementation (https://github.com/nodejs/node/blob/master/lib/_tls_wrap.js#L1083) expects a truthy value returned from the function as the error, and has no try / catch logic to catch an error if thrown, with the result that if the checkServerIdentity function throws an error the whole process will likely exit. Either the docs or the implementation should be corrected to reflect the intended behavior.

Activity

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

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.tlsIssues and PRs related to the tls subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions