GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tls: get the local certificate after tls handshake by sam-github · Pull Request #24261 · nodejs/node

Conversation

@sam-github

@sam-github sam-github commented Nov 8, 2018

Copy link
Copy Markdown
Contributor

Add an API to get the local certificate chosen during TLS handshake from
the SSL context.

Fix: #24095

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@nodejs-github-bot

nodejs-github-bot commented Nov 8, 2018

Copy link
Copy Markdown
Collaborator

@sam-github build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/1549/pipeline

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. labels Nov 8, 2018
@sam-github sam-github mentioned this pull request Nov 8, 2018
Ability to check TLS contexts, servernames, altnames #24095
Closed
@sam-github sam-github added the semver-minor PRs that contain new features and should be released in the next minor version. label Nov 8, 2018
bnoordhuis
bnoordhuis reviewed Nov 9, 2018
View reviewed changes
Comment thread doc/api/tls.md Outdated

@bnoordhuis bnoordhuis Nov 9, 2018

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you be more specific than "some"?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sam-github sam-github Nov 9, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty vague, isn't it! ;-) This is the extent of the current documentation for parsed cert objects, unchanged since 0c42fac51596a68a6be02ea537e5ec03f228844b. Its on my list to fix, but for now I'd like to leave as-is. The wording of these docs are close to identical as possible to the docs for https://nodejs.org/api/tls.html#tls_tlssocket_getpeercertificate_detailed. I'm working on a PR to add EC and DH key info to X509ToObject, and I promise to doc the cert format then, and reorganize the docs, since the cert can show up in a handful of APIs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sam-github sam-github Nov 14, 2018

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/to @bnoordhuis as promised, #24358

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread doc/api/tls.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/node_crypto.cc Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/node_crypto.cc Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sam-github
sam-github force-pushed the tls-get-cert branch from 9bb96e6 to 74fa19f Compare November 9, 2018 17:54
bnoordhuis
bnoordhuis approved these changes Nov 9, 2018
View reviewed changes

@bnoordhuis bnoordhuis left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Sam, LGTM.

One thing: you may want to stick in an exports.translatePeerCertificate = exports.translateCertChain to stop it from being semver-major.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sam-github

sam-github commented Nov 9, 2018

Copy link
Copy Markdown
Contributor Author

I don't want it to be semver-major, I'll put the original name back.

Whats the current way to hide our internal API? Could I move translatePeerCert into internal/ with a better name, and export a deprecated wrapper from _tls_common?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sam-github

sam-github commented Nov 9, 2018

Copy link
Copy Markdown
Contributor Author

ci: https://ci.nodejs.org/job/node-test-pull-request/18470

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented Nov 9, 2018

Copy link
Copy Markdown
Member

Could I move translatePeerCert into internal/ with a better name, and export a deprecated wrapper from _tls_common?

Yep.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sam-github

sam-github commented Nov 10, 2018

Copy link
Copy Markdown
Contributor Author

ci: https://ci.nodejs.org/job/node-test-pull-request/18475/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax
addaleax approved these changes Nov 10, 2018
View reviewed changes
Comment thread doc/api/tls.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell reviewed Nov 10, 2018
View reviewed changes
Comment thread doc/api/tls.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sam-github
sam-github force-pushed the tls-get-cert branch from ecfe565 to a8c6016 Compare November 13, 2018 20:51
@sam-github

sam-github commented Nov 13, 2018

Copy link
Copy Markdown
Contributor Author

ci: https://ci.nodejs.org/job/node-test-pull-request/18588/

James, Anna - thanks for catching the typo.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

danbev
danbev approved these changes Nov 14, 2018
View reviewed changes
Comment thread src/node_crypto.cc Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sam-github
tls: get the local certificate after tls handshake
f8f571f
Add an API to get the local certificate chosen during TLS handshake from
the SSL context.

Fix: nodejs#24095
@sam-github
sam-github force-pushed the tls-get-cert branch from a8c6016 to f8f571f Compare November 14, 2018 04:41
@sam-github

sam-github commented Nov 14, 2018

Copy link
Copy Markdown
Contributor Author

Landed in db35fee

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sam-github sam-github closed this Nov 14, 2018
@sam-github
sam-github deleted the tls-get-cert branch November 14, 2018 04:43
sam-github added a commit that referenced this pull request Nov 14, 2018
@sam-github
tls: get the local certificate after tls handshake
db35fee
Add an API to get the local certificate chosen during TLS handshake from
the SSL context.

Fix: #24095

PR-URL: #24261
Fixes: #24095
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
BridgeAR pushed a commit that referenced this pull request Nov 14, 2018
@sam-github @BridgeAR
tls: get the local certificate after tls handshake
30d6f63
Add an API to get the local certificate chosen during TLS handshake from
the SSL context.

Fix: #24095

PR-URL: #24261
Fixes: #24095
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
kiyomizumia pushed a commit to kiyomizumia/node that referenced this pull request Nov 15, 2018
@sam-github @kiyomizumia
tls: get the local certificate after tls handshake
d76674c
Add an API to get the local certificate chosen during TLS handshake from
the SSL context.

Fix: nodejs#24095

PR-URL: nodejs#24261
Fixes: nodejs#24095
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
BridgeAR pushed a commit that referenced this pull request Nov 15, 2018
@sam-github @BridgeAR
tls: get the local certificate after tls handshake
d6f91ba
Add an API to get the local certificate chosen during TLS handshake from
the SSL context.

Fix: #24095

PR-URL: #24261
Fixes: #24095
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
@BridgeAR BridgeAR mentioned this pull request Nov 15, 2018
Release proposal: v11.2 #24350
Merged
This was referenced Nov 15, 2018
2018-11-15 Version 11.2.0 (Current) @BridgeAR beevelop/docker-nodejs#232
Closed
2018-11-15 Version 11.2.0 (Current) @BridgeAR beevelop/docker-android-nodejs#249
Closed
2018-11-15 Version 11.2.0 (Current) @BridgeAR beevelop/docker-nodejs#233
Closed
This was referenced Nov 16, 2018
2018-11-15 Version 11.2.0 (Current) @BridgeAR beevelop/docker-nodejs#234
Closed
2018-11-15 Version 11.2.0 (Current) @BridgeAR beevelop/docker-nodejs#235
Closed
2018-11-15 Version 11.2.0 (Current) @BridgeAR beevelop/docker-nodejs#236
Closed
addaleax added a commit to addaleax/node that referenced this pull request Jan 14, 2019
@addaleax
tls: do not free cert in .getCertificate()
7611f1b
The documentation of `SSL_get_certificate` states that it returns
an internal pointer that must not be freed by the caller.

Therefore, using a smart pointer to take ownership is incorrect.

Refs: https://man.openbsd.org/SSL_get_certificate.3
Refs: nodejs#24261
Fixes: https://github.com/nodejs-private/security/issues/217
@addaleax addaleax mentioned this pull request Jan 14, 2019
tls: do not free cert in .getCertificate() #25490
Closed
3 tasks done
@addaleax

addaleax commented Jan 14, 2019

Copy link
Copy Markdown
Member

If this is backported to LTS, it should go with #25490.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax added a commit that referenced this pull request Jan 21, 2019
@addaleax
tls: do not free cert in .getCertificate()
e888f66
The documentation of `SSL_get_certificate` states that it returns
an internal pointer that must not be freed by the caller.

Therefore, using a smart pointer to take ownership is incorrect.

Refs: https://man.openbsd.org/SSL_get_certificate.3
Refs: #24261
Fixes: https://github.com/nodejs-private/security/issues/217

PR-URL: #25490
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
addaleax added a commit that referenced this pull request Jan 23, 2019
@addaleax
tls: do not free cert in .getCertificate()
c3409f5
The documentation of `SSL_get_certificate` states that it returns
an internal pointer that must not be freed by the caller.

Therefore, using a smart pointer to take ownership is incorrect.

Refs: https://man.openbsd.org/SSL_get_certificate.3
Refs: #24261
Fixes: https://github.com/nodejs-private/security/issues/217

PR-URL: #25490
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
zcbenz pushed a commit to electron/node that referenced this pull request Mar 27, 2019
@addaleax @zcbenz
tls: do not free cert in .getCertificate()
afbc0fd
The documentation of `SSL_get_certificate` states that it returns
an internal pointer that must not be freed by the caller.

Therefore, using a smart pointer to take ownership is incorrect.

Refs: https://man.openbsd.org/SSL_get_certificate.3
Refs: nodejs/node#24261
Fixes: https://github.com/nodejs-private/security/issues/217

PR-URL: nodejs/node#25490
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@sam-github sam-github mentioned this pull request Apr 26, 2019
[v10.x backport] TLS1.3 (and dependent PRs) #27432
Closed
sam-github added a commit to sam-github/node that referenced this pull request Apr 29, 2019
@sam-github
tls: get the local certificate after tls handshake
5f5d3c9
Add an API to get the local certificate chosen during TLS handshake from
the SSL context.

Fix: nodejs#24095

PR-URL: nodejs#24261
Fixes: nodejs#24095
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
sam-github pushed a commit to sam-github/node that referenced this pull request Apr 29, 2019
@addaleax @sam-github
tls: do not free cert in .getCertificate()
8c7406f
The documentation of `SSL_get_certificate` states that it returns
an internal pointer that must not be freed by the caller.

Therefore, using a smart pointer to take ownership is incorrect.

Refs: https://man.openbsd.org/SSL_get_certificate.3
Refs: nodejs#24261
Fixes: https://github.com/nodejs-private/security/issues/217

PR-URL: nodejs#25490
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell left review comments
@bnoordhuis bnoordhuis bnoordhuis approved these changes
@addaleax addaleax addaleax approved these changes
+1 more reviewer
@danbev danbev danbev approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Ability to check TLS contexts, servernames, altnames

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@sam-github @nodejs-github-bot @bnoordhuis @addaleax @danbev @jasnell
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.