-
Notifications
You must be signed in to change notification settings - Fork 552
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
Feature: Provide an easier way to retrieve SBOM from In-Toto attestation #2307
Comments
Slight off-topic: I think there should be a way to avoid the warnings when using Edit: I've created the issue #2528 to continue the discussion I've started in comment #2307 (comment). This issue should continue to focus on making it easier to extract an SBOM from an in-toto attestation. |
In relation to your first question, do you think that a flag such as |
on the second question - in order to sign the SBOMs, have you up until now been using |
Yes, that would surely suffice.
No, we are calling these to commands directly in succession:
The latter command seems to be little known, since I've never seen it mentioned anywhere. That's why I created a PR: #2308 I think it would be nice if we could combine these commands into |
#2526 points out that have docs such that when you follow them, Cosign emits warnings: https://docs.sigstore.dev/cosign/other_types/#sboms-software-bill-of-materials |
After some investigation yesterday, I think this issue is even more important than I thought. Just a few months ago @otms61 created a PR for Trivy so that Trivy now natively supports scanning cyclonedx-predicates embedded in attestations: aquasecurity/trivy#2652 This PR has some shortcomings:
Why I am telling you this here instead of creating an issue over at Trivy? Well, my point is that it should not be the burden of Trivy to support all kinds of "container" formats that SBOMs could be embedded in. If cosign would provide a way to easily retrieve the original SBOM from an attestation predicate, then aquasecurity/trivy#2652 would be completely obsolete and @otms61 surely wouldn't have seen a need to even create the PR. I propose a new option for the
If the attestation contains more than one predicate of the given type, cosign could just concatenate the decoded predicates (see |
I can take on adding the Here's my understanding. When using this flag, the output of the two commands below should be almost the same:
The description suggests the
Neither one of those would work with the suggested @ChristianCiach, is using |
@lcarva First of all, thank you!
It is my understanding that |
It just occurred to me that my proposed solution ( I am not an expert when it comes to the in-toto format, but as far as I understand it, there can be multiple predicates for the same In #2307 (comment) I proposed to just concat the JSON documents, using one line for each document (see So what should be do? Options:
Edit:
|
Good points! I have a suggestion that might help. Given that a certain predicate type is expected to have a certain structure, it would be very unusual to have a mix of data types when filtering by a particular predicate type. And that, AFAICT, it's not possible to use And that we mostly care about JSON data for this particular feature. And that multiple JSON documents can be easily represented with JSONL. (One JSON document per line.) Then, let's introduce a new output type called If someone uses Thoughts? |
That would be perfectly fine for me, since I am only interested in cyclonedx-json predicates. That being said, I don't feel it is particularly smart to specialise in specific predicate types. Your solution seems a bit too custom-tailored to my specific use-case. That being said, cosign already is specialised for specific predicate types (since there is special support for certain |
It looks like I've underestimated the complexity of this feature request. I am perfectly comfortable with continuing to work out the details before we implement some solution that turns out to be a bad idea. |
It also seems like my assumption is incorrect. CycloneDX appears to use the same predicate type for both JSON and XML. So my suggestion may be naive. It also means that inferring the data format from the predicate type is not a viable solution. To be fair, I do not know of many instances where the predicate is not JSON. My perception is that this is the pseudo-standard format for predicates, but admittedly I don't have a large sample size to give this statement any merit. But! My suggestion is not specifically targeting your use case; it's also targeting mine. Having to use Having said all that, I still think my suggestion is reasonable and should work for most cases. That's ok because it's optional - the behavior is not being imposed on anyone. We can always improve it over time as other use cases become clearer. I would be interested in also hearing what others think in case @ChristianCiach and I just happen to have a narrow view of the problem. |
Thanks for your insight. Maybe it's wise to just do nothing for now. When cosign releases its next version and users are facing the deprecation warnings for the |
Hey all, great to see that this issue is still being crunched through in my absence! I am pretty interested in how this issue shapes up looking towards a proposed implementation. I will probably at some point be looking to do similar in the witness project! Everything you have both discussed is very valid and I think it's important to consider as close to every possible edge case before implementing something. I do think however that the biggest use case for a feature like this is the "I am learning / debugging and I just want to view the predicate". If that can be done without creating situations where people feel upon using it that it is dysfunctional due to a lack of support of their specific scenario, I think it would be a worthwhile feature 😄 |
Since #1756 cosign issues a warning when using
cosign attach sbom
andcosign download sbom
, heavily encouraging users to usecosign attest
andcosign download attestation
instead:While I don't really like this change, because all our sboms are signed and there is no need to scare the users like that, we are trying to migrate to use said attestations.
Unfortunately, there doesn't seem to be an easy way to retrieve the original SBOM document from an attestation. The
cosign download sbom
could be used to retrieve the original SBOM (and nothing else), but this is a lot harder when using attestations:This is the easiest way I could come up. This also requires the user to have additional tools available (
jq
in this case).I think there should be a command to retrieve the original SBOM (producing the exact same output) as it is already possible with
cosign download sbom
. Currently, SBOMs attached as attestation-predicates feel like second-class citizens.The text was updated successfully, but these errors were encountered: