Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API docs: type for TLS Certificate's subjectaltname field is wrong. #27721

Closed
cakoose opened this issue May 15, 2019 · 2 comments
Closed

API docs: type for TLS Certificate's subjectaltname field is wrong. #27721

cakoose opened this issue May 15, 2019 · 2 comments
Labels
doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. tls Issues and PRs related to the tls subsystem.

Comments

@cakoose
Copy link

cakoose commented May 15, 2019

The API doc says it's an array (link):

  • subjectaltname <Array> (Optional) An array of names for the subject, an alternative to the subject names.

But there's an example below those docs that shows a string:

subjectaltname: 'DNS:*.nodejs.org, DNS:nodejs.org',

When I use TlsSocket.getPeerCertificate() myself, I get a string.

@bnoordhuis bnoordhuis added doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. tls Issues and PRs related to the tls subsystem. labels May 16, 2019
@dannyb648
Copy link
Contributor

dannyb648 commented May 16, 2019

I'll put a PR in this evening to fix this.

I'll double check that TlsSocket.getPeerCertificate() does return a string as @cakoose says, and update the docs accordingly

@cakoose
Copy link
Author

cakoose commented May 16, 2019

Steps you can use to check getPeerCertificate():

get-peer-certificate.js

const https = require('https');
https.get('https://httpbin.org/get', res => {
    console.log('getPeerCertificate', res.socket.getPeerCertificate());
});
$ node get-peer-certificate.js
...
  subjectaltname: 'DNS:httpbin.org, DNS:*.httpbin.org',
...

facebook-github-bot pushed a commit to facebook/flow that referenced this issue May 16, 2019
Summary:
Node API documentation: https://nodejs.org/api/tls.html#tls_certificate_object

Note: the API docs for `subjectaltname` say "Array" but it's actually a string (nodejs/node#27721).
Pull Request resolved: #7727

Reviewed By: dsainati1

Differential Revision: D15377748

Pulled By: mvitousek

fbshipit-source-id: 092e0da8ca84f2910488fd6c2c39bb3ccafa3378
dannyb648 added a commit to dannyb648/node that referenced this issue May 17, 2019
Within tls.md, the documentation for the response of
tlsSocket.getPeerCertificate() included subjectaltname
documented as an array of values. However these values are
actually returned as a single string of concatenated values.
The documentation has been updated to reflect this.

Fixes: nodejs#27721
@danbev danbev closed this as completed in 0ca9297 May 21, 2019
BridgeAR pushed a commit that referenced this issue May 21, 2019
Within tls.md, the documentation for the response of
tlsSocket.getPeerCertificate() included subjectaltname
documented as an array of values. However these values are
actually returned as a single string of concatenated values.
The documentation has been updated to reflect this.

PR-URL: #27757
Fixes: #27721
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. tls Issues and PRs related to the tls subsystem.
Projects
None yet
3 participants