Skip to content

Add a path validation warning for empty DN entries#5656

Open
randombit wants to merge 1 commit into
masterfrom
jack/warn-on-empty-dn-name
Open

Add a path validation warning for empty DN entries#5656
randombit wants to merge 1 commit into
masterfrom
jack/warn-on-empty-dn-name

Conversation

@randombit

Copy link
Copy Markdown
Owner

RFC 5280's DirectoryString definition clearly indicates it should be non-empty. Add a warning during path validation for this, similar to the DN too long issue.

RFC 5280's DirectoryString definition clearly indicates it should be non-empty.
Add a warning during path validation for this, similar to the DN too long issue.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new X.509 path validation warning when a certificate’s subject DN contains an empty DirectoryString attribute value, aligning validation behavior with RFC 5280 guidance (similar in spirit to the existing DN length warning).

Changes:

  • Detect and flag empty DN attribute values during path validation.
  • Introduce a new Certificate_Status_Code warning value for this condition.
  • Add a human-readable to_string() entry for the new status code.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/lib/x509/x509path.cpp Adds detection of empty DN attribute values during chain checking.
src/lib/x509/pkix_enums.h Introduces a new warning status code for empty DN entries.
src/lib/x509/cert_status.cpp Adds a string representation for the new warning code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib/x509/pkix_enums.h
Comment on lines 38 to 41
TRUSTED_CERT_HAS_EXPIRED = 504,
TRUSTED_CERT_NOT_YET_VALID = 505,
EMPTY_DIRECTORYNAME = 506,

Comment thread src/lib/x509/x509path.cpp
Comment on lines +380 to +383
if(dn_len == 0) {
// RFC 5280 DirectoryStrings are supposed to be non-empty
status.insert(Certificate_Status_Code::EMPTY_DIRECTORYNAME);
} else if(dn_ub > 0 && dn_len > dn_ub) {
Comment on lines +36 to +37
case Certificate_Status_Code::EMPTY_DIRECTORYNAME:
return "DirectoryName was empty";
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