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

feat: add validation of required fields in the bundle #189

Merged
merged 5 commits into from
Jul 29, 2024

Conversation

vishal-chdhry
Copy link
Contributor

@vishal-chdhry vishal-chdhry commented May 26, 2024

Summary

Ref #63

Sigstore bundle protobuf spec has field_behavior annotation which is used to describe field behavior, such as a field being required or immutable as described in AIP-203.

This PR adds verification of top-level required fields in the bundle.

TODO

Fix validation of oneof fields

Release Note

Add validation of required fields in the bundle

Documentation

@haydentherapper
Copy link
Contributor

Overall LGTM, pending figuring out the issue with required one_of fields. Thanks for adding this!

@vishal-chdhry vishal-chdhry marked this pull request as ready for review June 1, 2024 17:25
@vishal-chdhry
Copy link
Contributor Author

updated the PR @haydentherapper

kommendorkapten
kommendorkapten previously approved these changes Jun 4, 2024
haydentherapper
haydentherapper previously approved these changes Jun 5, 2024
Copy link
Contributor

@haydentherapper haydentherapper left a comment

Choose a reason for hiding this comment

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

This is a good start, though the linked issue isn't completed by this. The library you were using originally is what we need to do verification of nested fields, otherwise we're just validating top level fields.

I'm fine with merging this as-is, I've changed the PR description to not close the issue.

@vishal-chdhry
Copy link
Contributor Author

The library you were using originally is what we need to do verification of nested fields, otherwise we're just validating top level fields.

Would the better solution be to use the library after it has better support for oneof fields (The AIP does not state anything specific about how to handle oneof so I am not sure if we can get something added to the library)
or,
Should I just add validation for all the imported fields?

@haydentherapper
Copy link
Contributor

I think the library would be the best path forward. Maybe we can post an issue there to see if they have suggestions for handling one-ofs in a way that is AIP compliant?

@vishal-chdhry
Copy link
Contributor Author

logged an issue for this in the library: einride/aip-go#300

@haydentherapper
Copy link
Contributor

@vishal-chdhry Do you want to rebase for the tests, and we'll merge this as is?

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
@haydentherapper haydentherapper merged commit b06e631 into sigstore:main Jul 29, 2024
10 checks passed
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