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

Add Reference field type #133

Closed
wants to merge 4 commits into from

Conversation

marcelamelara
Copy link
Contributor

@marcelamelara marcelamelara commented Feb 6, 2023

This PR adds a new primitive field type for artifact references. and changes the type of the subject field in the Statement to this new type.

Related to #2 and #27. Addresses #117. Part of #130 .

@marcelamelara marcelamelara requested a review from a team February 6, 2023 19:41
@marcelamelara marcelamelara force-pushed the ref-field-type branch 3 times, most recently from eb4c2b5 to 5a92825 Compare February 6, 2023 19:50
Copy link
Contributor

@TomHennen TomHennen left a comment

Choose a reason for hiding this comment

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

Would it make sense to put this in the v1.0-draft spec instead of here with 0.1?

@marcelamelara
Copy link
Contributor Author

@TomHennen Yes! So I wanted to figure out what the best order of operations is between this merging PR and #132. I think we should merge yours first, and I'll rebase on that then. Thoughts?

@TomHennen
Copy link
Contributor

Yeah that sounds right. :)

@marcelamelara marcelamelara mentioned this pull request Feb 6, 2023
10 tasks
@marcelamelara marcelamelara force-pushed the ref-field-type branch 3 times, most recently from 05d7cee to 1a5c857 Compare February 6, 2023 21:26
Signed-off-by: Marcela Melara <[email protected]>
Signed-off-by: Marcela Melara <[email protected]>
spec/v1.0-draft/field_types.md Outdated Show resolved Hide resolved
@TomHennen
Copy link
Contributor

@MarkLodato you might have thoughts here

Copy link
Contributor

@MarkLodato MarkLodato left a comment

Choose a reason for hiding this comment

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

What is the purpose of this change? What use case is this enabling that cannot be done before? That is not explained in the PR description, and it's not clear to me.

As I have said previously, I think the clearest, simplest model is that an attestation is about an immutable thing that can be hashed. Extending it to represent a subject that is mutable makes it more confusing. Before going down that road, I'd like to see what the use case is and consider what the alternatives are.

spec/v1.0-draft/README.md Outdated Show resolved Hide resolved
spec/v1.0-draft/field_types.md Outdated Show resolved Hide resolved
@TomHennen
Copy link
Contributor

TomHennen commented Feb 8, 2023

What is the purpose of this change? What use case is this enabling that cannot be done before? That is not explained in the PR description, and it's not clear to me.

As I have said previously, I think the clearest, simplest model is that an attestation is about an immutable thing that can be hashed. Extending it to represent a subject that is mutable makes it more confusing. Before going down that road, I'd like to see what the use case is and consider what the alternatives are.

I'm not the expert in what's going on with SLSA, but I think a good example of an attestation about something that can't be hashed is a statement that refers to a builder ID.

I could imagine:

"subject": [{"uri": "https://cloudbuild.googleapis.com/GoogleHostedWorker@v1"}],
"predicateType": "https://example.com/slsa-build-level",
"predicate": {
    "attestorId": "https://slsa-conformance.dev",
    "slsaLevel": "LEVEL_3"
}

Which says that https://slsa-conformance.dev has confirmed that the builder identified by https://cloudbuild.googleapis.com/GoogleHostedWorker@v1 has been verified to be SLSA L3.

@marcelamelara
Copy link
Contributor Author

@MarkLodato My main reasoning for changing the subject's type is to enable verifiers to download the subject if they do not obtain the attestation together with the subject artifact.

My initial proposal in #117 included only the digest and downloadLocation fields because I agree that matching should occur on digest, not on URI. (Yes, given your explanation, I totally agree that SBOM, logs, etc are all artifacts). This is also the reason I am generally on the fence about having both digest and uri fields, but I wanted to start off with the current SLSA v1 ArtifactReference format and take it from there.

@TomHennen In your example, does the URI for the builderID actually point to an underlying artifact?

@TomHennen
Copy link
Contributor

@TomHennen In your example, does the URI for the builderID actually point to an underlying artifact?

No not necessarily,.

If we want to go the easy route we could:

  1. Define ArtifactReference (or whatever) as a type
  2. Leave subject as it currently is (just name & digest)
  3. Enhance subject as needed in some future revision.

I think this would unblock all the current concrete needs?

@marcelamelara
Copy link
Contributor Author

@TomHennen I'm starting to think it might be worth handling artifact and service references (like the one in your example) through separate field types.

Since the current subject field already doesn't support service-type references, I don't think that expanding it to an ArtifactReference type would really break the current semantics, while still providing the extra downloadLocation and mimeType fields (and not adding the uri field). We can resolve adding support for service-references in subjects at a later point. Thoughts?

@TomHennen
Copy link
Contributor

That sounds good to me.

@MarkLodato
Copy link
Contributor

MarkLodato commented Feb 10, 2023

To clarify, my only main concern is semantics of the subject. If there is clear documentation, I'm (probably) good. Something like:

"The attestation is bound to either subject.digest or subject.uri. Exactly one of these fields is required for each entry in subject. All other fields are informational."

As an analogy, consider car ownership. The title is like an attestation whose subject is the VIN. There are lots of other identifying details about the car in the title, such as the make, model, color, weight, etc., but the only thing "binding" is the VIN. When you want to look up a car's ownership, you only compare the car's VIN to the title's VIN. The other attributes are irrelevant (though useful in other contexts). Similarly, if you're referring to a car, you might say "That red Honda CR-V located on that side of the street, with license plate ABCXYZ and VIN 1234"; this has useful information in it, but only the VIN is used to compare to the title.

Signed-off-by: Marcela Melara <[email protected]>
@marcelamelara
Copy link
Contributor Author

@MarkLodato Thanks for the clarification and language suggestions.

I've pushed some updates based on our discussions. For now, we've decided to defer changing the subject field type since we don't have any concrete use cases for a reference-type subject just yet. I've also removed the uri field to make the reference specifically for hashable artifacts. We'll address referencing non-hashable resources separately.

marcelamelara added a commit to marcelamelara/in-toto.attestation that referenced this pull request Feb 14, 2023
spec/v1.0-draft/field_types.md Show resolved Hide resolved
marcelamelara added a commit to marcelamelara/in-toto.attestation that referenced this pull request Feb 22, 2023
marcelamelara added a commit to marcelamelara/in-toto.attestation that referenced this pull request Feb 22, 2023
@marcelamelara
Copy link
Contributor Author

Closing in favor of #143.

@marcelamelara marcelamelara deleted the ref-field-type branch May 10, 2023 21:04
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.

5 participants