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
Addressing custom extension fields #1015
Comments
To my limited knowledge: With proto3, I don't think there's a good answer. Proto3 basically ignores unknown fields and does not support extension fields, so you need to maintain your own version of the .proto file. With proto2, I wonder if you could use extensions for this purpose? Something like: // provenance.proto, converted to proto2 syntax
syntax = "proto2";
package slsa.v1;
message Provenance {
optional BuildDefinition build_definition = 1;
optional RunDetails run_details = 2;
extensions 1000 to max;
} // extension.proto
syntax = "proto2";
package mycompany;
extend slsa.v1.Provenance {
optional Thing mycompany_thing = 123456;
}
message Thing {
// ...
} I don't know if this produces the proper JSON; needs testing. Also the API for accessing extensions is more awkward than regular fields. |
@kanchan-dhamane Did you or your team have any other thoughts here? |
@pxp928 , we don't want to maintain a custom implementation. Can we add extension field in |
This is more of a question for the slsa maintainers. @MarkLodato Do you have thoughts around this? |
I guess what @pxp928 is suggesting is to, instead of putting extensions directly on any message, all messages have an |
https://slsa.dev/spec/v1.0/provenance#extension-fields allows for custom extension fields to be generated but the current implementation of the protobuf does not accommodate for these fields.
Is there guidance on how these fields should be used and parsed? For example, if company X made its own extension fields, would they have to maintain their own version of the protobuf?
Are there other recommendations on how this should be done (if not using protobuf)?
The text was updated successfully, but these errors were encountered: