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

RFC: change high-level API to make key usage explicit #133

Merged
merged 5 commits into from
Jul 26, 2023
Merged

RFC: change high-level API to make key usage explicit #133

merged 5 commits into from
Jul 26, 2023

Conversation

djc
Copy link
Member

@djc djc commented Jul 24, 2023

Inspired by #119, I was thinking it might make sense to stop having a bunch of different but mostly similar verification functions, and instead provide a single API call that (a) makes the key usage parameter explicit, and in exchange (b) does away with the shallow trust anchor slice wrappers.

As written, this maintains the explicit connection to a particular key usage but does it in a more generic way. I've chosen methods on ExtendedKeyUsage for the common usage values here, but we could alternatively expose these as consts and/or potentially hide the ExtendedKeyUsage enum inside an opaque struct to force callers to go through an explicit API.

cc @sietseringers

@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Merging #133 (e7e1b21) into main (d96f6f5) will decrease coverage by 0.58%.
The diff coverage is 91.07%.

@@            Coverage Diff             @@
##             main     #133      +/-   ##
==========================================
- Coverage   95.74%   95.16%   -0.58%     
==========================================
  Files          15       15              
  Lines        3431     3620     +189     
==========================================
+ Hits         3285     3445     +160     
- Misses        146      175      +29     
Files Changed Coverage Δ
src/trust_anchor.rs 90.27% <ø> (-0.80%) ⬇️
src/end_entity.rs 68.26% <71.42%> (-31.74%) ⬇️
src/verify_cert.rs 95.18% <93.87%> (-0.70%) ⬇️

... and 4 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

src/verify_cert.rs Outdated Show resolved Hide resolved
src/end_entity.rs Show resolved Hide resolved
@djc
Copy link
Member Author

djc commented Jul 25, 2023

This triggers the semver check because we're adding a #[deprecated] attribute which apparently merits a minor version bump. Given that our major is zero, it seems that we should treat minor and patch the same way, so this is fine?

Copy link
Member

@cpu cpu left a comment

Choose a reason for hiding this comment

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

Thanks, this seems like a nice improvement 👍

tests/custom_ekus.rs Show resolved Hide resolved
src/end_entity.rs Show resolved Hide resolved
@djc
Copy link
Member Author

djc commented Jul 25, 2023

Reduced coverage is mostly about the deprecated functions which we no longer call in tests, I think that's okay?

Copy link
Member

@ctz ctz left a comment

Choose a reason for hiding this comment

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

💯

@djc
Copy link
Member Author

djc commented Jul 25, 2023

Given that we're going to bump to 0.102 anyway for the optional ring PR, can we pull that in here to avoid the deprecation stuff?

@ctz
Copy link
Member

ctz commented Jul 25, 2023

Sorry, yes let's hold this till tomorrow. I would like to release an 0.101.2 (mainly to get #132 out) before moving main to 0.102.x. I think the deprecations require a semver bump anyway -- we can't control downstreams that write deny(warnings)?

@djc
Copy link
Member Author

djc commented Jul 25, 2023

I think that's what they're opting into anyway if they set deny(warnings)... Would be nice to release this with the deprecations, giving people a chance to migrate with deprecations rather than hard compile failures?

@ctz
Copy link
Member

ctz commented Jul 25, 2023

@djc
Copy link
Member Author

djc commented Jul 25, 2023

Improved the documentation for verify_for_usage() to mention usage and crls, so I think this could just be merged for 0.101.2.

@ctz ctz enabled auto-merge July 26, 2023 08:41
@ctz
Copy link
Member

ctz commented Jul 26, 2023

Ah, this isn't merging because ci / Check semver compatibility wants to see the minor version bumped for deprecated items. That's not really ideal :(

@ctz ctz disabled auto-merge July 26, 2023 08:53
@djc
Copy link
Member Author

djc commented Jul 26, 2023

@ctz we can hit the "Merge without waiting for requirements to be met" for this case?

Or alternatively exclude the semver stuff from the merge queue checks.

@ctz ctz merged commit 875fcef into main Jul 26, 2023
38 of 42 checks passed
@ctz ctz deleted the eku branch July 26, 2023 09:34
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.

3 participants