Add a path validation warning for empty DN entries#5656
Open
randombit wants to merge 1 commit into
Open
Conversation
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.
There was a problem hiding this comment.
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_Codewarning 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 on lines
38
to
41
| TRUSTED_CERT_HAS_EXPIRED = 504, | ||
| TRUSTED_CERT_NOT_YET_VALID = 505, | ||
| EMPTY_DIRECTORYNAME = 506, | ||
|
|
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"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.