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

Fix handling of empty subject names in certs #102

Merged
merged 1 commit into from
Mar 11, 2021
Merged

Conversation

eliykat
Copy link
Member

@eliykat eliykat commented Mar 11, 2021

Objective

Node had a bug which would reject public certificates as empty if their subject was empty, even if they had altNames defined. See nodejs/node#22906.

This bug was fixed in node 12.14.1. Our electron version uses a later node version, so it doesn't affect the electron app.

However, the bwdc CLI uses the locally installed node version, so users on older node versions are still susceptible.

Code changes

The bug resides in node's TLS checkServerIdentity function. We can provide our own checkServerIdentity function in the ldapjs client options. Our function works by inserting a non-null subject line before calling the standard function.

This is based on auth0's workaround which I have referenced in the comment. (Let me know if this is unnecessary.)

Testing

This now correctly validates a test certificate (provided by a customer) with an empty subject and altNames defined, in node v12.0 (pre-bugfix). I have also tested on v14.15.4 to make sure it doesn't interfere with later versions of Node (post-bugfix).

@eliykat eliykat requested a review from a team March 11, 2021 03:04
@eliykat eliykat requested review from a team and removed request for a team March 11, 2021 03:07
@eliykat eliykat merged commit 9cfa646 into master Mar 11, 2021
@eliykat eliykat deleted the cert-empty-subject branch March 11, 2021 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants