Skip to content

Fix handling of empty subject names in certs#102

Merged
eliykat merged 1 commit intomasterfrom
cert-empty-subject
Mar 11, 2021
Merged

Fix handling of empty subject names in certs#102
eliykat merged 1 commit intomasterfrom
cert-empty-subject

Conversation

@eliykat
Copy link
Copy Markdown
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
sso-bitwarden pushed a commit to sso-bitwarden/directory-connector that referenced this pull request Aug 28, 2025
Fix handling of empty subject names in certs
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