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

keyid documented, but not annotated, as optional in io.intoto.Signature #324

Open
jku opened this issue May 13, 2024 · 3 comments
Open

keyid documented, but not annotated, as optional in io.intoto.Signature #324

jku opened this issue May 13, 2024 · 3 comments

Comments

@jku
Copy link
Member

jku commented May 13, 2024

message Signature {
  // Signature itself. (In JSON, this is encoded as base64.)
  // REQUIRED.
  bytes sig = 1;

  // *Unauthenticated* hint identifying which public key was used.
  // OPTIONAL.
  string keyid = 2;
}

should maybe be optional string keyid = 2; -- alternatively should not be documented as optional and should instead suggest a placeholder value?

@jku
Copy link
Member Author

jku commented May 13, 2024

ah, I've just been told in this version of protobuf optional is the default 🤷

So maybe this is not a bug at all... It feels wrong that the generated code annotations now don't expose optionality at all but this seems to be as designed.

@haydentherapper
Copy link
Collaborator

Yea, optional is now the default in proto3. We should be annotating sig as required though based on the comment.

@woodruffw
Copy link
Member

Summarizing from a discussion in the Sigstore Slack:

This is caused by the mess that is optional/required semantics in proto3 -- in proto3 everything is implicitly optional, even if not marked with the optional qualifier. This is made even more complicated by the fact that the optional qualifier was actually removed from proto3, but then re-added in 3.15.

Ideally we'd use optional to mark optionality (which would result in correct type hints in the Python bindings), but this may change the wire format (although I'm not sure this actually would matter, since everybody uses the JSON format). But even with that change, everything that isn't marked as optional is still optional (thanks to "implicit field presence").

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

No branches or pull requests

3 participants