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

verification: fill in policy API internals #9642

Merged
merged 66 commits into from
Sep 30, 2023

Conversation

woodruffw
Copy link
Contributor

This follows #9405 by rounding out the internals of the Rust-side Policy API.

Break-out from #8873.

woodruffw and others added 30 commits August 11, 2023 15:19
Signed-off-by: William Woodruff <[email protected]>

validation: remove Profile abstract from public APIs

One step towards removing it entirely

Signed-off-by: William Woodruff <[email protected]>

policy: disambiguate references

Signed-off-by: William Woodruff <[email protected]>

policy: remove separate rfc5280 profile

Signed-off-by: William Woodruff <[email protected]>

policy: remove profile abstraction entirely

Signed-off-by: William Woodruff <[email protected]>

rust: permitted_algorithms filtering

Signed-off-by: William Woodruff <[email protected]>

verify: simplify policy API substantially

No more manual monomorphization.

Signed-off-by: William Woodruff <[email protected]>

src, tests: remove verification code

Signed-off-by: William Woodruff <[email protected]>

validation: remove more validation code

Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Not used, yet.

Signed-off-by: William Woodruff <[email protected]>
This reverts commit a5154e1.
Will include these in a subsequent PR.

Signed-off-by: William Woodruff <[email protected]>
Not needed yet.

Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
No configurable profile, Web PKI only.

Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
As part of the MVP.

Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Not part of these changes.

Signed-off-by: William Woodruff <[email protected]>
Not needed yet; not part of MVP.

Signed-off-by: William Woodruff <[email protected]>
@woodruffw woodruffw marked this pull request as ready for review September 25, 2023 14:33
src/rust/cryptography-x509-validation/src/policy/mod.rs Outdated Show resolved Hide resolved
pub fn new(ops: B, subject: Option<Subject<'a>>, time: asn1::DateTime) -> Self {
/// Create a new policy with defaults for the certificate profile defined in
/// the CA/B Forum's Basic Requirements.
pub fn webpki(ops: B, subject: Option<Subject<'a>>, time: asn1::DateTime) -> Self {
Copy link
Member

Choose a reason for hiding this comment

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

Why did WebPKI come back?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bad merge, will fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 90e502b -- I kept the doc change since the defaults are changing internally, but I can also revert that if you'd prefer.

Comment on lines 194 to 195
pub(crate) critical_ca_extensions: HashSet<ObjectIdentifier>,
pub(crate) critical_ee_extensions: HashSet<ObjectIdentifier>,
Copy link
Member

Choose a reason for hiding this comment

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

Do I understand right that the point of these to enforce that some extensions must be marked critical?

@reaperhulk let me know if you disagree, but I don't think we care about enforcing that: it's a lot of compatibility cost, for effectively no gain. I don't believe any other validators enforce "this extension must be marked critical", just the inverse (rejecting unknown critical extensions).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do I understand right that the point of these to enforce that some extensions must be marked critical?

Yep, that understanding is right.

I'll reconfirm against the WIP limbo suite, but I believe we found that at OpenSSL, at least, seems to care when some mandatory-critical extensions aren't marked as such.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just checked: OpenSSL and Go's crypto/x509 both reject certificates with AKI/SKI marked as critical, as RFC 5280 explicitly states that both MUST NOT be critical.

Both also check whether basicConstraints is critical, as is mandated under 5280.

Copy link
Member

@alex alex left a comment

Choose a reason for hiding this comment

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

I'm going to apologize, because I think this is a recurring theme in my reviews:

This PR brings in the APIs around customizing the verification logic in various ways.

I think at this point it'd be better to get a minimal path verifier, and then layer these additional validations on top of that, rather than build in the extension points and then try to do a complete verifier.

Happy to hear arguments the other way, but I think it'll be much easier to review if we can do the functional pieces and then generalize.

/// Creates a new policy with the given `CryptoOps`, an optional subject,
/// and a validation time.
/// Create a new policy with defaults for the certificate profile defined in
/// the CA/B Forum's Basic Requirements.
Copy link
Member

Choose a reason for hiding this comment

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

The only default from CAB here is the permitted algorithms and the EKU right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, the actual policy logic itself isn't filled in yet.

@woodruffw
Copy link
Contributor Author

woodruffw commented Sep 28, 2023

Happy to hear arguments the other way, but I think it'll be much easier to review if we can do the functional pieces and then generalize.

Nope, you're absolutely right -- I'll make a concerted effort to pare this and the other stack of PRs down.

Rust-only, unused, non-MVP.

Signed-off-by: William Woodruff <[email protected]>
@alex alex merged commit 9f90767 into pyca:main Sep 30, 2023
58 checks passed
@woodruffw woodruffw deleted the tob-x509-policy-without-permits branch February 26, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants