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 — crypto: explicitly enable auto cert chaining by nornagon · Pull Request #22110 · nodejs/node

Conversation

@nornagon

@nornagon nornagon commented Aug 3, 2018 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

OpenSSL enables this feature by default, but BoringSSL doesn't, because it's expensive and unnecessary (see boringssl/27 and boringssl/42). This change makes it so that when building node with BoringSSL, the behaviour matches OpenSSL's.

Electron will be building node.js with BoringSSL in future, and we've floated this patch on our fork (see electron/node#47).

Checklist
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

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

All reactions
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto subsystem. labels Aug 3, 2018
@addaleax

addaleax commented Aug 3, 2018

Copy link
Copy Markdown
Member

@nodejs/crypto

All reactions

Sorry, something went wrong.

Uh oh!

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

@Trott

Trott commented Aug 4, 2018

Copy link
Copy Markdown
Member

@nodejs/security-wg

All reactions

Sorry, something went wrong.

Uh oh!

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

@tniessen

tniessen commented Aug 4, 2018

Copy link
Copy Markdown
Member

Not objecting, but a couple of questions:

  • You are saying it is "expensive and unnecessary" and one of their commit messages contains this paragraph:

    In transition to removing it altogether, set SSL_MODE_NO_AUTO_CHAIN by
    default. If we find some consumer was relying on it, this will allow
    them to revert locally with SSL_(CTX_)clear_mode, but hopefully this was
    just unused.

    How does node rely on this behavior when built with BoringSSL? Is their assessment correct that node shouldn't rely on it?

  • The same commit suggests that the flag will be removed altogether in the future. How would we compensate for that?

  • Is this the only required change to make node work with BoringSSL?

All reactions

Sorry, something went wrong.

Uh oh!

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

@nornagon

nornagon commented Aug 5, 2018

Copy link
Copy Markdown
Contributor Author

How does node rely on this behavior when built with BoringSSL?

The specific behaviour I observed was when setting up a server with a self-signed cert, and providing the root/intermediate certs in the ca list, rather than writing the cert chain directly into the pem.

const server = https.createServer({
  key: fs.readFileSync(path.join(certPath, 'server.key')),
  cert: fs.readFileSync(path.join(certPath, 'server.pem')),
  ca: [
    fs.readFileSync(path.join(certPath, 'rootCA.pem')),
    fs.readFileSync(path.join(certPath, 'intermediateCA.pem'))
  ],
  requestCert: true,
  rejectUnauthorized: false
}, ...)

With automatic cert chaining, which is enabled by default in OpenSSL, a trust chain will be built for the cert on every handshake (see OpenSSL and BoringSSL, which also caches the chain). If this behaviour is disabled, which is the default in BoringSSL, then the certificate chain will not be automatically built from certs that are available in the CA list.

I think changing this behaviour in node—to not build these chains automatically—has the potential to be fairly disruptive, since it changes core APIs (https and tls) in a subtly breaking way. That said, there is a simple workaround, which is to build certificate chains ahead of time.

The same commit suggests that the flag will be removed altogether in the future. How would we compensate for that?

See boringssl/42, which is closed as WontFix, since wpa_supplicant depends on the auto-chaining feature too. So its removal from BoringSSL seems unlikely. Even if it were removed from BoringSSL, since Node.js doesn't officially support BoringSSL, I imagine there'd be no work for the Node.js team to do at all :)

Is this the only required change to make node work with BoringSSL?

In Electron, the only other changes we need to get node to compile with BoringSSL are a few #defines.
That said, I'm not an expert on the differences between BoringSSL and OpenSSL, and the full scope of what you mean when you say "work" is beyond me. OpenSSL is a massive library with a lot of functionality. But it compiles and runs and serves HTTPS—even without this PR!

All reactions

Sorry, something went wrong.

Uh oh!

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

@tniessen

tniessen commented Sep 9, 2018

Copy link
Copy Markdown
Member

We most likely won't support BoringSSL officially (which isn't recommended by BoringSSL anyway). Personally, I am okay with merging this with a comment explaining why this line is necessary and maybe also a preprocessor directive to skip this for non-BoringSSL builds. Pinging @nodejs/tsc for opinions.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Trott

Trott commented Sep 9, 2018

Copy link
Copy Markdown
Member

No opinion on the change, but without at least a comment explaining the line, this risks being removed in a refactor at a later date.

tniessen reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

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

tniessen
tniessen approved these changes Sep 11, 2018
View reviewed changes
ryzokuken
ryzokuken approved these changes Sep 18, 2018
View reviewed changes
@ryzokuken

ryzokuken commented Sep 18, 2018

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@nornagon
fix: enable auto cert chaining to match OpenSSL behaviour
bc35f30
@nornagon
nornagon force-pushed the enable-auto-chaining branch from e90b790 to bc35f30 Compare September 18, 2018 19:54
jasnell
jasnell approved these changes Sep 19, 2018
View reviewed changes
@addaleax

addaleax commented Sep 19, 2018

Copy link
Copy Markdown
Member

New CI: https://ci.nodejs.org/job/node-test-pull-request/17325/

All reactions

Sorry, something went wrong.

Uh oh!

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

@addaleax addaleax added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Sep 19, 2018
bnoordhuis
bnoordhuis approved these changes Sep 26, 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.

LGTM. CI failure is infrastructural. I'd say this PR is ready to land.

Sorry, something went wrong.

Uh oh!

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

All reactions
@tniessen

tniessen commented Sep 27, 2018

Copy link
Copy Markdown
Member

Landed in 7dae872.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tniessen tniessen closed this Sep 27, 2018
tniessen pushed a commit that referenced this pull request Sep 27, 2018
@nornagon @tniessen
crypto: enable auto cert chaining for BoringSSL
7dae872
OpenSSL enables this feature by default, but BoringSSL doesn't. This
change makes it so that when building node with BoringSSL, the
behaviour matches OpenSSL's.

PR-URL: #22110
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Ujjwal Sharma <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
targos pushed a commit that referenced this pull request Sep 27, 2018
@nornagon @targos
crypto: enable auto cert chaining for BoringSSL
b2e7da0
OpenSSL enables this feature by default, but BoringSSL doesn't. This
change makes it so that when building node with BoringSSL, the
behaviour matches OpenSSL's.

PR-URL: #22110
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Ujjwal Sharma <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
targos pushed a commit that referenced this pull request Oct 3, 2018
@nornagon @targos
crypto: enable auto cert chaining for BoringSSL
074b7af
OpenSSL enables this feature by default, but BoringSSL doesn't. This
change makes it so that when building node with BoringSSL, the
behaviour matches OpenSSL's.

PR-URL: #22110
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Ujjwal Sharma <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@targos targos mentioned this pull request Oct 7, 2018
Release proposal: v10.12.0 #23313
Merged
This was referenced Oct 10, 2018
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#225
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#239
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#226
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#240
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#227
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#241
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#242
Closed
This was referenced Oct 11, 2018
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#228
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#243
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#229
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bnoordhuis bnoordhuis bnoordhuis approved these changes
@jasnell jasnell jasnell approved these changes
@tniessen tniessen tniessen approved these changes
+1 more reviewer
@ryzokuken ryzokuken ryzokuken 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

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. crypto Issues and PRs related to the crypto 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.

8 participants

@nornagon @addaleax @Trott @tniessen @ryzokuken @bnoordhuis @jasnell @nodejs-github-bot
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.