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

cosign: Allow use of regex in CertSubjectEmailVerifier #300

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

dave-tucker
Copy link
Contributor

@dave-tucker dave-tucker commented Sep 18, 2023

Summary

This allows for either an exact match [StringVerifier::ExactMatch]
or it allows for a regular expression [StringVerifier::Regex]

This supports the use case of trusting signatures from a
collection of email addresses e.g .*@redhat.com and or from a
collection of issuers.

Fixes: #299

Release Note

  • CertSubjectEmailVerifier is now constructed using either a StringVerifer enum. This supports exact string matches or regular expressions.

Documentation

Docstrings and examples are updated to show how this is used.

Copy link
Member

@flavio flavio left a comment

Choose a reason for hiding this comment

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

I like the idea, I'm in favor of implementing this change.

The code looks good, but I have some suggestions. These might be a matter of personal taste, hence I'm open to have a discussion about how to proceed.

My proposal would be to change the StringVerifier from being a trait to be a simple enum. We could have something like StringVerifier::ExactMatch(String) and StringVerifier::Regex(Regex). This would make the code easier to understand for our end consumers and we could get rid of the dynamic dispatch introduced by the usage of the trait.

What do you think?

@dave-tucker
Copy link
Contributor Author

I like the idea, I'm in favor of implementing this change.

The code looks good, but I have some suggestions. These might be a matter of personal taste, hence I'm open to have a discussion about how to proceed.

My proposal would be to change the StringVerifier from being a trait to be a simple enum. We could have something like StringVerifier::ExactMatch(String) and StringVerifier::Regex(Regex). This would make the code easier to understand for our end consumers and we could get rid of the dynamic dispatch introduced by the usage of the trait.

What do you think?

Makes sense to me. I've updated the patch with your proposal.

Copy link
Member

@flavio flavio left a comment

Choose a reason for hiding this comment

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

I like it, thanks for having done the proposed change.

Aside from the nitpick comment (which would be great to see addressed, but I don't consider that mandatory), can you please address the inline docs feedback please?

This allows for either an exact match [StringVerifier::ExactMatch]
or it allows for a regular expression [StringVerifier::Regex]

This supports the use case of trusting signatures from a
collection of email addresses e.g .*@redhat.com and or from a
collection of issuers.

Fixes: sigstore#299

Signed-off-by: Dave Tucker <[email protected]>
Copy link
Member

@flavio flavio left a comment

Choose a reason for hiding this comment

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

I realized this PR got stuck. I solved the conflicts with the main branch.

I'll merge it once all the tests are green

@flavio
Copy link
Member

flavio commented Sep 20, 2024

@Xynnn007 can you please give me an approval? I had to fix the conflicts with the main branch, but I didn't do any change to the original code submitted by @dave-tucker

@flavio
Copy link
Member

flavio commented Sep 20, 2024

@Xynnn007 thanks!

@dave-tucker sorry about the delay!

@flavio flavio merged commit 75243ac into sigstore:main Sep 20, 2024
7 checks passed
flavio added a commit to flavio/sigstore-rs that referenced this pull request Feb 6, 2025
== What's Changed
* cosign: Allow use of regex in CertSubjectEmailVerifier by @dave-tucker in sigstore#300
* build(deps): bump rustsec/audit-check from 1.4.1 to 2.0.0 by @dependabot in sigstore#396
* build(deps): bump actions/checkout from 4.1.7 to 4.2.0 by @dependabot in sigstore#397
* build(deps): update rstest requirement from 0.22 to 0.23 by @dependabot in sigstore#399
* build(deps): update testcontainers requirement from 0.22 to 0.23 by @dependabot in sigstore#398
* automation: fix GHA invoking cargo audit by @flavio in sigstore#400
* Cosign | Add support for client to configure a proxy to pull signatures by @Xynnn007 in sigstore#392
* build(deps): bump actions/checkout from 4.2.0 to 4.2.1 by @dependabot in sigstore#401
* CONTRIBUTORS.md: Add note about tests and building by @jku in sigstore#404
* cosign: fix regex dependency import by @Xynnn007 in sigstore#411
* Lint tests too by @jku in sigstore#405
* Simplify cosign verify-bundle example by @jku in sigstore#408
* Examples: Add a minimal example of bundle sign/verify by @jku in sigstore#410
* build(deps): update tough requirement from 0.18 to 0.19 by @dependabot in sigstore#407
* cosign: Make verify-blob compatible with sigstore-python by @jku in sigstore#403
* build(deps): update oci-client requirement from 0.13 to 0.14 by @dependabot in sigstore#418
* build(deps): bump actions/checkout from 4.2.1 to 4.2.2 by @dependabot in sigstore#417
* Deprecate actions-rs actions by @jku in sigstore#415
* build(deps): update cached requirement from 0.53 to 0.54 by @dependabot in sigstore#421
* build(deps): update thiserror requirement from 1.0 to 2.0 by @dependabot in sigstore#420
* build(deps): bump Swatinem/rust-cache from 2.7.5 to 2.7.7 by @dependabot in sigstore#422
* fix clippy complaint by @bobcallaway in sigstore#425
* fix zizmor issues in github actions workflows by @bobcallaway in sigstore#424
* build(deps): update rstest requirement from 0.23 to 0.24 by @dependabot in sigstore#423
* Update embedded trust root by @jku in sigstore#431
* build(deps): update sigstore_protobuf_specs requirement from 0.3 to 0.4 by @dependabot in sigstore#430
* chore(deps): upgrade openidconnect by @flavio in sigstore#433

== New Contributors
* @dave-tucker made their first contribution in sigstore#300
* @jku made their first contribution in sigstore#404

**Full Changelog**: sigstore/sigstore-rs@v0.10.0...v0.11.0

Signed-off-by: Flavio Castelli <[email protected]>
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.

Allow for Regex in CertSubjectEmailVerifier
3 participants