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

Addressing custom extension fields #1015

Open
pxp928 opened this issue Jan 5, 2024 · 5 comments
Open

Addressing custom extension fields #1015

pxp928 opened this issue Jan 5, 2024 · 5 comments

Comments

@pxp928
Copy link
Contributor

pxp928 commented Jan 5, 2024

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)?

@MarkLodato
Copy link
Member

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.

@pxp928
Copy link
Contributor Author

pxp928 commented Jan 22, 2024

@kanchan-dhamane Did you or your team have any other thoughts here?

@kanchan-dhamane
Copy link

@pxp928 , we don't want to maintain a custom implementation. Can we add extension field in RunDetails similar to the external_parameters?

@pxp928
Copy link
Contributor Author

pxp928 commented Jan 24, 2024

@pxp928 , we don't want to maintain a custom implementation. Can we add extension field in RunDetails similar to the external_parameters?

This is more of a question for the slsa maintainers. @MarkLodato Do you have thoughts around this?

@MarkLodato
Copy link
Member

I guess what @pxp928 is suggesting is to, instead of putting extensions directly on any message, all messages have an extensions field that is a map from extension name to JSON object. That would make it easier to express in protobuf and probably more future-proof. I'm open to that. Maybe we should do that in SLSA v1.1, and make that recommendation for other predicate types in the in-toto attestation repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants