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

Clarify usage of VerificationLogEntry.canonicalized_body. #74

Merged
merged 1 commit into from
Apr 3, 2023

Conversation

wlynch
Copy link
Member

@wlynch wlynch commented Mar 30, 2023

Summary

This updates the doc comment of canonicalized_body to make it clear that it is an optional field, and provides more details on when the field should be set / when it can be safely omitted.

This is not intended to be a change in behavior - this is just clarifying existing intent of the field.

Fixes #72

Release Note

  • Updated the description of VerificationLogEntry.canonicalized_body to clarify when it should be set / when it can be safely omitted.

Documentation

If there's anything else I need to do besides make all, let me know!

This updates the doc comment of canonicalize_body to make it clear that
it is an optional field, and provides more details on when the field
should be set / when it can be safely omitted.

Signed-off-by: Billy Lynch <billy@chainguard.dev>
@wlynch
Copy link
Member Author

wlynch commented Mar 30, 2023

// `canonicalized_body` matches the signature provided in the
// `Bundle.content`.
// If not set, clients are responsible for constructing an equivalent
// payload from other sources to verify the signature.
bytes canonicalized_body = 7;
Copy link
Member

Choose a reason for hiding this comment

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

Should this have the optional keyword?

Suggested change
bytes canonicalized_body = 7;
optional bytes canonicalized_body = 7;

Copy link
Member Author

Choose a reason for hiding this comment

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

¯_(ツ)_/¯ I'm in different.

proto3 generally takes a stance of everything is "optional", i.e. it's not considered an error if you don't set a field, it just won't include it in serialization if it's the zero value. IIUC the optional keyword for proto3 is really for field existence if you want to distinguish between the field wasn't set vs the empty string was set, which I don't think gives us much value in this context.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha, yeah it's unclear how declaring optional should affect anything. In server code, anything can be nil anyway and must be checked, so there's functionally no difference.

@kommendorkapten kommendorkapten merged commit 4dbf10b into sigstore:main Apr 3, 2023
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.

FR: Separate canonicalized_body from TransparencyLogEntry?
5 participants