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 — src: add .code and SSL specific error properties by sam-github · Pull Request #25093 · nodejs/node

Conversation

@sam-github

@sam-github sam-github commented Dec 17, 2018

Copy link
Copy Markdown
Contributor

SSL errors have a long structured message, but lacked the standard .code
property which can be used for stable comparisons. Add a code
property, as well as the 3 string components of an SSL error: reason,
library, and function.

This is WIP, TBD is move the property strings to the isolate, and add docs and more tests.

I've seen a reasonable amount of code that is doing string matching on the error string, looking for the reason part, I think exposing the properties makes more sense. Also, I think the intention is for all Errors to expose .code properties for stable programmatic inspection.

I've gone some way to exposing these properties for node_crypto.cc, too, but I'm not done. Once this PR lands I'll keep working on it.

/to @nodejs/crypto

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 and jasnell reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@nodejs-github-bot

nodejs-github-bot commented Dec 17, 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/1983/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++. tls Issues and PRs related to the tls subsystem. labels Dec 17, 2018
jasnell
jasnell reviewed Dec 18, 2018
View reviewed changes
Comment thread src/tls_wrap.cc Resolved

Uh oh!

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

jasnell
jasnell reviewed Dec 18, 2018
View reviewed changes
Comment thread src/tls_wrap.cc Resolved

Uh oh!

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

@sam-github

sam-github commented Dec 18, 2018

Copy link
Copy Markdown
Contributor Author

@jasnell PTAL

All reactions

Sorry, something went wrong.

Uh oh!

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

jasnell
jasnell approved these changes Dec 18, 2018
View reviewed changes
@sam-github
sam-github force-pushed the tls-error-codes branch from 35dc539 to 18c6c1f Compare December 20, 2018 17:28
danbev
danbev approved these changes Dec 21, 2018
View reviewed changes
@danbev

danbev commented Dec 21, 2018

Copy link
Copy Markdown
Contributor

@sam-github LGTM apart from I'm seeing the same test failures locally as reported by the CI run.

Details
$ out/Release/node --tls-v1.1 /Users/danielbevenius/work/nodejs/node/test/parallel/test-tls-cli-min-version-1.1.js
assert.js:86
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ undefined
- 'ERR_SSL_VERSION_TOO_LOW'
    at common.mustCall (/Users/danielbevenius/work/nodejs/node/test/parallel/test-tls-min-max-version.js:31:14)
    at /Users/danielbevenius/work/nodejs/node/test/common/index.js:373:15
    at /Users/danielbevenius/work/nodejs/node/test/common/index.js:373:15
    at maybeCallback (/Users/danielbevenius/work/nodejs/node/test/fixtures/tls-connect.js:97:7)
    at Server.<anonymous> (/Users/danielbevenius/work/nodejs/node/test/fixtures/tls-connect.js:84:7)
    at Server.emit (events.js:188:13)
    at TLSSocket.onSocketTLSError (_tls_wrap.js:728:29)
    at TLSSocket.emit (events.js:188:13)
    at TLSSocket._tlsError (_tls_wrap.js:608:8)
    at TLSSocket.emit (events.js:188:13)
All reactions

Sorry, something went wrong.

Uh oh!

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

addaleax
addaleax reviewed Dec 21, 2018
View reviewed changes

@addaleax addaleax 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.

LGTM with a comment

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread src/tls_wrap.cc Resolved

Uh oh!

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

@sam-github
src: add .code and SSL specific error properties
04e841c
SSL errors have a long structured message, but lacked the standard .code
property which can be used for stable comparisons. Add a `code`
property, as well as the 3 string components of an SSL error: `reason`,
`library`, and `function`.
@sam-github
sam-github force-pushed the tls-error-codes branch from 18c6c1f to 04e841c Compare December 27, 2018 18:39
@sam-github

sam-github commented Dec 27, 2018

Copy link
Copy Markdown
Contributor Author

@danbev Oops, reordered the error number peek to after the error message long-form printf while addressing some comments, which doesn't work (printf clears the err number). Tests are passing again locally, lets see how CI does.

All reactions

Sorry, something went wrong.

Uh oh!

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

@sam-github

sam-github commented Dec 27, 2018

Copy link
Copy Markdown
Contributor Author

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@sam-github

sam-github commented Dec 27, 2018

Copy link
Copy Markdown
Contributor Author

Landed in ca9c0c9

All reactions

Sorry, something went wrong.

Uh oh!

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

@sam-github sam-github closed this Dec 27, 2018
@sam-github
sam-github deleted the tls-error-codes branch December 27, 2018 22:29
sam-github added a commit that referenced this pull request Dec 27, 2018
@sam-github
src: add .code and SSL specific error properties
ca9c0c9
SSL errors have a long structured message, but lacked the standard .code
property which can be used for stable comparisons. Add a `code`
property, as well as the 3 string components of an SSL error: `reason`,
`library`, and `function`.

PR-URL: #25093
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
@addaleax addaleax added the backport-requested-v11.x label Jan 5, 2019
@addaleax

addaleax commented Jan 5, 2019

Copy link
Copy Markdown
Member

Should this be backported to v11.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label.

All reactions

Sorry, something went wrong.

Uh oh!

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

@sam-github sam-github mentioned this pull request Jan 7, 2019
[v11.x backport] src: add .code and SSL specific error properties #25376
Closed
4 tasks
sam-github added a commit to sam-github/node that referenced this pull request Jan 7, 2019
@sam-github
src: add .code and SSL specific error properties
345ffbe
SSL errors have a long structured message, but lacked the standard .code
property which can be used for stable comparisons. Add a `code`
property, as well as the 3 string components of an SSL error: `reason`,
`library`, and `function`.

Backport-PR-URL: https://github.com/nodejs/node/25376
PR-URL: nodejs#25093
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
@sam-github

sam-github commented Jan 7, 2019

Copy link
Copy Markdown
Contributor Author

Depends on #24729, semver-major, so not a backport candidate.

All reactions

Sorry, something went wrong.

Uh oh!

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

@sam-github sam-github added dont-land-on-v11.x and removed backport-requested-v11.x labels Jan 7, 2019
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
@sam-github @refack
src: add .code and SSL specific error properties
dd8b655
SSL errors have a long structured message, but lacked the standard .code
property which can be used for stable comparisons. Add a `code`
property, as well as the 3 string components of an SSL error: `reason`,
`library`, and `function`.

PR-URL: nodejs#25093
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
@sam-github sam-github mentioned this pull request Mar 22, 2019
Decorate crypto openssl errors with .code, .reason, ... #26868
Closed
4 tasks done
@sam-github sam-github added the semver-minor PRs that contain new features and should be released in the next minor version. label Mar 27, 2019
@sam-github sam-github mentioned this pull request Mar 28, 2019
[v11.x backport] TLS1.3 #26951
Closed
3 of 4 tasks
sam-github added a commit to sam-github/node that referenced this pull request Mar 28, 2019
@sam-github
src: add .code and SSL specific error properties
24dbb96
SSL errors have a long structured message, but lacked the standard .code
property which can be used for stable comparisons. Add a `code`
property, as well as the 3 string components of an SSL error: `reason`,
`library`, and `function`.

PR-URL: nodejs#25093
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
@sam-github sam-github mentioned this pull request Mar 28, 2019
[v11.x backport] src: add .code and SSL specific error properties #26953
Closed
4 tasks
sam-github added a commit to sam-github/node that referenced this pull request Apr 1, 2019
@sam-github
src: add .code and SSL specific error properties
f45613a
SSL errors have a long structured message, but lacked the standard .code
property which can be used for stable comparisons. Add a `code`
property, as well as the 3 string components of an SSL error: `reason`,
`library`, and `function`.

PR-URL: nodejs#25093
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
sam-github added a commit to sam-github/node that referenced this pull request Apr 11, 2019
@sam-github
src: add .code and SSL specific error properties
69d53f6
SSL errors have a long structured message, but lacked the standard .code
property which can be used for stable comparisons. Add a `code`
property, as well as the 3 string components of an SSL error: `reason`,
`library`, and `function`.

PR-URL: nodejs#25093
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
BethGriggs pushed a commit that referenced this pull request Apr 15, 2019
@sam-github @BethGriggs
src: add .code and SSL specific error properties
8b5d350
SSL errors have a long structured message, but lacked the standard .code
property which can be used for stable comparisons. Add a `code`
property, as well as the 3 string components of an SSL error: `reason`,
`library`, and `function`.

Backport-PR-URL: #26951
PR-URL: #25093
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
@codebytere codebytere mentioned this pull request Apr 19, 2019
v11.15.0 proposal #27314
Merged
codebytere added a commit that referenced this pull request Apr 19, 2019
@codebytere
2019-04-23, Version 11.15.0 (Current)
3669215
Notable changes:

* deps: add s390 asm rules for OpenSSL-1.1.1 (Shigeki Ohtsu) [#19794](#19794)
* src: add .code and SSL specific error properties (Sam Roberts) [#25093](#25093)
* tls:
  * add --tls-min-v1.2 CLI switch (Sam Roberts) [#26951](#26951)
  * supported shared openssl 1.1.0 (Sam Roberts) [#26951](#26951)
  * revert default max toTLSv1.2 (Sam Roberts) [#26951](#26951)
  * revert change to invalid protocol error type (Sam Roberts) [#26951](#26951)
  * support TLSv1.3 (Sam Roberts) [#26209](#26209)
  * add code for ERR\_TLS\_INVALID\_PROTOCOL\_METHOD (Sam Roberts) [#24729](#24729)
codebytere added a commit that referenced this pull request Apr 19, 2019
@codebytere
2019-04-23, Version 11.15.0 (Current)
171465f
Notable changes:

* deps: add s390 asm rules for OpenSSL-1.1.1 (Shigeki Ohtsu) [#19794](#19794)
* src: add .code and SSL specific error properties (Sam Roberts) [#25093](#25093)
* tls:
  * add --tls-min-v1.2 CLI switch (Sam Roberts) [#26951](#26951)
  * supported shared openssl 1.1.0 (Sam Roberts) [#26951](#26951)
  * revert default max toTLSv1.2 (Sam Roberts) [#26951](#26951)
  * revert change to invalid protocol error type (Sam Roberts) [#26951](#26951)
  * support TLSv1.3 (Sam Roberts) [#26209](#26209)
  * add code for ERR\_TLS\_INVALID\_PROTOCOL\_METHOD (Sam Roberts) [#24729](#24729)
This was referenced Apr 23, 2019
2019-04-23 Version 12.0.0 (Current) @BethGriggs beevelop/docker-android-nodejs#302
Closed
2019-04-23 Version 12.0.0 (Current) @BethGriggs beevelop/docker-nodejs#275
Closed
2019-04-23 Version 12.0.0 (Current) @BethGriggs beevelop/docker-nodejs#276
Closed
2019-04-23 Version 12.0.0 (Current) @BethGriggs beevelop/docker-android-nodejs#303
Closed
2019-04-23 Version 12.0.0 (Current) @BethGriggs beevelop/docker-nodejs#277
Closed
2019-04-23 Version 12.0.0 (Current) @BethGriggs beevelop/docker-android-nodejs#304
Closed
2019-04-23 Version 12.0.0 (Current) @BethGriggs beevelop/docker-nodejs#278
Closed
2019-04-23 Version 12.0.0 (Current) @BethGriggs beevelop/docker-android-nodejs#305
Closed
2019-04-23 Version 12.0.0 (Current) @BethGriggs beevelop/docker-nodejs#279
Closed
2019-04-23 Version 12.0.0 (Current) @BethGriggs beevelop/docker-android-nodejs#306
Closed
codebytere added a commit that referenced this pull request Apr 30, 2019
@codebytere
2019-04-30, Version 11.15.0 (Current)
e65a904
Notable changes:

* deps: add s390 asm rules for OpenSSL-1.1.1 (Shigeki Ohtsu) [#19794](#19794)
* src: add .code and SSL specific error properties (Sam Roberts) [#25093](#25093)
* tls:
  * add --tls-min-v1.2 CLI switch (Sam Roberts) [#26951](#26951)
  * supported shared openssl 1.1.0 (Sam Roberts) [#26951](#26951)
  * revert default max toTLSv1.2 (Sam Roberts) [#26951](#26951)
  * revert change to invalid protocol error type (Sam Roberts) [#26951](#26951)
  * support TLSv1.3 (Sam Roberts) [#26209](#26209)
  * add code for ERR\_TLS\_INVALID\_PROTOCOL\_METHOD (Sam Roberts) [#24729](#24729)

PR-URL: #27314
codebytere added a commit that referenced this pull request Apr 30, 2019
@codebytere
2019-04-30, Version 11.15.0 (Current)
ea46db6
Notable changes:

* deps: add s390 asm rules for OpenSSL-1.1.1 (Shigeki Ohtsu) [#19794](#19794)
* src: add .code and SSL specific error properties (Sam Roberts) [#25093](#25093)
* tls:
  * add --tls-min-v1.2 CLI switch (Sam Roberts) [#26951](#26951)
  * supported shared openssl 1.1.0 (Sam Roberts) [#26951](#26951)
  * revert default max toTLSv1.2 (Sam Roberts) [#26951](#26951)
  * revert change to invalid protocol error type (Sam Roberts) [#26951](#26951)
  * support TLSv1.3 (Sam Roberts) [#26209](#26209)
  * add code for ERR\_TLS\_INVALID\_PROTOCOL\_METHOD (Sam Roberts) [#24729](#24729)

PR-URL: #27314
@BethGriggs BethGriggs added the dont-land-on-v10.x label Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@addaleax addaleax addaleax left review comments
@jasnell jasnell jasnell 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++. semver-minor PRs that contain new features and should be released in the next minor version. tls Issues and PRs related to the tls subsystem.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

6 participants

@sam-github @nodejs-github-bot @danbev @addaleax @jasnell @BethGriggs
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 01402503 — 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.