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

ignore invalid value validating dns name list #69

Merged
merged 4 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/subject_name/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub(crate) fn verify_cert_dns_name(
if let GeneralName::DnsName(presented_id) = name {
match dns_name::presented_id_matches_reference_id(presented_id, dns_name) {
Ok(true) => return NameIteration::Stop(Ok(())),
Ok(false) => (),
Ok(false) | Err(Error::MalformedDnsIdentifier) => (),
Err(e) => return NameIteration::Stop(Err(e)),
}
}
Expand Down
11 changes: 11 additions & 0 deletions tests/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,17 @@ def name_constraints() -> None:
],
)

generate_name_constraints_test(
Copy link
Member

Choose a reason for hiding this comment

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

There are some lint issues in the Python code, please check the CI results.

cpu marked this conversation as resolved.
Show resolved Hide resolved
output,
"invalid_dns_name_matching",
valid_names=["dns.example.com"],
subject_common_name="subject.example.com",
sans=[
x509.DNSName("{invalid}.example.com"),
x509.DNSName("dns.example.com"),
],
)


def signatures() -> None:
rsa_pub_exponent: int = 0x10001
Expand Down
7 changes: 7 additions & 0 deletions tests/name_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,10 @@ fn exclude_directory_name_not_implemented() {
Err(webpki::Error::UnknownIssuer)
);
}

#[test]
fn invalid_dns_name_matching() {
let ee = include_bytes!("name_constraints/invalid_dns_name_matching.ee.der");
let ca = include_bytes!("name_constraints/invalid_dns_name_matching.ca.der");
assert_eq!(check_cert(ee, ca, &["dns.example.com"], &[]), Ok(()));
}
Binary file not shown.
Binary file not shown.