-
Notifications
You must be signed in to change notification settings - Fork 47
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
tests: add name constraints integration test. #40
Conversation
// Note: We take the cheap way out here and assume single byte length - if the following | ||
// assert fails we'll need to more intelligently encode the sequence DER length. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little bit shoddy but I think probably sufficient for tests 🤷
// We don't expect any excluded subtrees as this time. | ||
assert!(constraints.excluded_subtrees.is_none()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could revisit this if it turns out that there will be trust anchors with name constraints including excluded subtrees. There aren't any today so I didn't bother complicating the testing harness to handle them.
d817342
to
99c5e77
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Some hopefully simplifying suggestions...
This commit adds integration testing for trust anchors in webpki-roots with name constraints. The general idea is that for each name constraints extension we: * parse the name constraints with x509-parser, verifying that the encoding is well formed and contains something approximating what we expect (e.g. at least one permitted subtree, no excluded subtrees). * convert the name constraints into the form rcgen expects for certificate generation parameters. * issue our own trust anchor CA certificate with the name constraints from the webpki trust anchor. * for each permitted subtree base dns name in the name constraints we use our generated CA to issue end entity certificates that will be permitted, and rejected by the name constraints. * we then translate our issued CA back to a webpki trust anchor, and use webpki to verify each of the permitted and rejected end entity certificates, asserting the result matches what we expect for the name constraint.
99c5e77
to
4c59e8a
Compare
Going to merge this w/ one review since it's only test code. Thanks! |
This is a follow up to #39 that adds a basic integration test for trust anchors in webpki-roots with name constraints.
The general idea is that for each name constraints extension we:
Checking out v0.25.1 and backporting this test identifies a problem with the KamuSM root name constraint, finding no subtrees after parsing:
With the fix from #39 the test passes.