Skip to content

Specifying rejectUnauthorized=true and verifyIdentity=false, unreachable code #2375

Closed
@juanheyns

Description

@juanheyns

When I specify rejectUnauthorized=true and verifyIdentity=false, I still get an error:

Hostname/IP does not match certificate's altnames: ...

So it seems like verifyIdentity does not have any effect. Looking at the code it seems like lib/connection.js line 372 is unreachable:

https://github.com/sidorares/node-mysql2/blob/1d983fa46031a77c689faea5f69e6e0baa1b3de7/lib/connection.js#L372C19-L372C19

      const ca = readFileSync(path.join(__dirname, `/ssl-ca/amazon-root-ca-1.pem`)).toString() // RDS Proxy
      
      pool = await createConnection({
        host,
        user,
        password,
        database,
        port,
        ssl: {
          ca,
          rejectUnauthorized: true,
          verifyIdentity: false
        }
      })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions