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

vulnerability attestation: ITE-9 specification #268

Merged
merged 4 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions spec/predicates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ our [vetting process], and may be of general interest:
artifact.
- [SPDX]: SPDX-formatted BOM for software artifacts.
- [CycloneDX]: CycloneDX BOM for software artifacts.
- [Vulnerability]: Defines the metadata to share the results of vulnerability scanning on software artifacts.
- [Test Result]: A generic schema to express results of any type of tests.

[CycloneDX]: https://cyclonedx.org/
[Link]: link.md
[New Predicate Guidelines]: ../../docs/new_predicate_guidelines.md
[Runtime Traces]: runtime-trace.md
[SCAI Report]: scai.md
[Vulnerability]: vuln.md
[SLSA Provenance]: https://slsa.dev/provenance
[SLSA Verification Summary]: vsa.md
[SPDX]: spdx.md
Expand Down
136 changes: 136 additions & 0 deletions spec/predicates/vuln.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Predicate type: Vulnerabilities

Type URI: https://in-toto.io/attestation/vulns/attribute-report
hectorj2f marked this conversation as resolved.
Show resolved Hide resolved

Version: 0.1

## Purpose

The definition of a vulnerability attestation type has been discussed in the past in [in-toto attestation](https://github.com/in-toto/attestation/issues/58) and [issue](https://github.com/sigstore/cosign/issues/442). However we need to identify two different purposes from these initial conversations:

* The definition of a common format to represent the results of a vulnerability report.

* The definition of a certain set of metadata fields that could help to consume these vulnerability attestations from the different scanning tools.

Obviously the first goal is quite challenging and requires a bigger community to agree upon a specific format. As a consequence, the following attestation type focuses on the definition of that common metadata which could enable the beginning of an exportable and manageable vulnerability attestation.

This document describes a vulnerability attestation type to represent vulnerability reports from the scanners in an "exportable" manner and independently of the format chosen to output the results.

## Prerequisites

The in-toto [attestation] framework and a [Vulnerability scanner tool].
hectorj2f marked this conversation as resolved.
Show resolved Hide resolved

## Use Cases
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: for some reason Markdown doesn't seem to identify this as a header?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

having a look at this!


When sharing the results of a vulnerability scan using an attestation, there is certain metadata that is crucial to trust and reuse this information.
Information about the scanner used during the scanning is relevant to trust these resuls. The state of the vulnerability database used to search for vulnerabilities defines the accuracy of the results. Other metadata information such as the timestamp when the scan finished could define the reusability of these results.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: resuls -> results


## Model

This is a predicate type that fits within the larger [Attestation] framework.
TomHennen marked this conversation as resolved.
Show resolved Hide resolved

## Schema

The schema of this predicate type is documented below.

### Fields

The fields that make up this predicate type are:

The `subject` contains whatever software artifacts are to be associated with this vulnerability report document.
The `predicate` contains a JSON-encoded data with the following fields:

**scanner**

> There are lots of container image scanners such as Trivy, Grype, Clair, etc.
> This field describes which scanner is used while performing a container image scan,
> as well as version information and which Vulnerability DB is used.

**scanner.uri** string (ResourceURI), optional

> > URI indicating the identity of the source of the scanner.

**scanner.version** string (ResourceURI), optional

> The version of the scanner.

**scanner.db.uri** string (ResourceURI), optional

> URI indicating the identity of the source of the Vulnerability DB.

**scanner.db.version** string, optional

> The version of the Vulnerability DB.

**scanner.db.lastUpdate string (Timestamp), required**

> The timestamp of when the vulnerability DB was updated last time.

**scanner.result** object
Copy link
Member

@pxp928 pxp928 Jul 24, 2023

Choose a reason for hiding this comment

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

As this is the most important, we should have a set struct that people should follow. For example, a field to specify vulnerabilityIDs and such.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed.

I'd probably expect a list of vulnerability identifiers coupled with severity. If you'd like to allow scanners to add additional custom information perhaps let them add annotations?

E.g.

scanner.result = [{"id": "CVE-123", "severity": "medium", "annotations": { "cvss_score": 5.2 }}, {...}]

I could see having different lists for CVEs vs OSV results?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It sounds good to me 👍🏻 !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TomHennen @pxp928 This suggestion makes sense to me. But I wanted to stay away from the defined format to represent the results at least for now. Users may prefer to use SARIF,or any other custom JSON format to set the results of the scan. I'd say a second iteration should define the format of this result struct.

wdyt ?

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO the real value from predicates is having the predicates be well defined so that consumers know how to use it. Without result being well defined I don't think there's much value. Perhaps I'm missing something?

Copy link
Contributor Author

@hectorj2f hectorj2f Jul 27, 2023

Choose a reason for hiding this comment

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

@TomHennen Sure! I highlighted it on the Purpose section. My initial goal was to define the metadata around the results which could help to exchange these attestations without having to solve the problem of which format to use when sharing the results of a vulnerability scan by any scanner.

However I am happy to move on defining a structure for the result's section if we feel we are ready to come to an agreement. cc @znewman01

Copy link
Member

Choose a reason for hiding this comment

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

Hey @hectorj2f, yes we should define a starting structure for the results for an initial release that we can iterate on if needed. For example, having a list of vulnerabilityIDs might be a start. Not sure if we want to include this but we could also have severity:

{
	"severity": [ {
		"type": string,
		"score": string
	} ]
}

similar to the osv implementation: https://ossf.github.io/osv-schema/#severity-field

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sgtm! I'll add these suggestions.


> This is the most important part of this field because it'll store the scan result as a whole. So, people might want
> to use this field to take decisions based on them by making use of Policy Engines tooling whether allow or deny these images.

**metadata.scanStartedOn string (Timestamp), required**

> The timestamp of when the scan started.

**metadata.scanFinishedOn string (Timestamp), required**

> The timestamp of when the scan completed.

## Example

```jsonc
{
"_type": "https://in-toto.io/Statement/v0.1",
hectorj2f marked this conversation as resolved.
Show resolved Hide resolved
"subject": [
{
...
hectorj2f marked this conversation as resolved.
Show resolved Hide resolved
}
],
// Predicate:
"predicateType": "https://in-toto.io/attestation/vulns/attribute-report/v0.1",
pxp928 marked this conversation as resolved.
Show resolved Hide resolved
"predicate": {
"invocation": {
"parameters": [],
// [ "--format=json", "--skip-db-update" ]
hectorj2f marked this conversation as resolved.
Show resolved Hide resolved
"uri": "",
// https://github.com/developer-guy/alpine/actions/runs/1071875574
hectorj2f marked this conversation as resolved.
Show resolved Hide resolved
"event_id": "",
// 1071875574
"builder.id": ""
// GitHub Actions
},
"scanner": {
"uri": "",
// pkg:github/aquasecurity/trivy@244fd47e07d1004f0aed9
"version": "",
// 0.19.2
"db": {
"uri": "",
// pkg:github/aquasecurity/trivy-db/commit/4c76bb580b2736d67751410fa4ab66d2b6b9b27d
"version": "",
// "v1-2021080612"
"lastUpdate": ""
// 2021-08-06T17:45:50.52Z
},
"result": {}
},
"metadata": {
"scanStartedOn": "",
// 2021-08-06T17:45:50.52Z
"scanFinishedOn": ""
// 2021-08-06T17:50:50.52Z
}
}
}
```

## Changelog and Migrations

Not applicable for this initial version.

[Attestation]: ../README.md