1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
|
# Cosign Vulnerability Scan Record Attestation Specification
`Cosign` is heavily using [In-toto Attestations](https://github.com/in-toto/attestation) predicate models in its own
codebase. But this is not the only option you have while working with predicates in cosign. `Cosign` already defines its
own predicates: [Generic Predicate Specification](COSIGN_PREDICATE_SPEC.md). This `Vulnerability Scan`
attestation is one of them.
Let's talk a bit about the history of this specification. We first mentioned this idea
in [in-toto attestation](https://github.com/in-toto/attestation/issues/58) repository. So many people interested in this
issue, and shared ideas about which parts are necessary which parts are not to make that specification well-purposed.
There is an also cross [issue](https://github.com/sigstore/cosign/issues/442) on cosign side that we discussed on it.
And the final format for this is defined as follows:
```json
{
"_type": "https://in-toto.io/Statement/v0.1",
"subject": [
{
...
}
],
// Predicate:
"predicateType": "https://cosign.sigstore.dev/attestation/vuln/v1",
"predicate": {
"invocation": {
"parameters": [],
// [ "--format=json", "--skip-db-update" ]
"uri": "",
// https://github.com/developer-guy/alpine/actions/runs/1071875574
"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"
},
"result": {}
},
"metadata": {
"scanStartedOn": "",
// 2021-08-06T17:45:50.52Z
"scanFinishedOn": ""
// 2021-08-06T17:50:50.52Z
}
}
}
```
## 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.result** object
> 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.
```shell
$ trivy image -f json alpine:3.12
```
<details>
<summary>Scan Result</summary>
```json
{
"SchemaVersion": 2,
"ArtifactName": "alpine:3.12",
"ArtifactType": "container_image",
"Metadata": {
"OS": {
"Family": "alpine",
"Name": "3.12.9"
},
"ImageID": "sha256:b0925e0819214cd29937af66dbaf0e6fe239997faea60922cc890f9984512507",
"DiffIDs": [
"sha256:eb4bde6b29a6746e0779f80a09ca6f0806de61475059f7d56d6e20f6cc2e15f7"
],
"RepoTags": [
"alpine:3.12"
],
"RepoDigests": [
"alpine@sha256:d9459083f962de6bd980ae6a05be2a4cf670df6a1d898157bceb420342bec280"
],
"ImageConfig": {
"architecture": "amd64",
"container": "385e1cc96cc7482dfb6847e293bb24baecd3f48a49791b9b45e297204b160287",
"created": "2021-11-12T17:20:08.442217528Z",
"docker_version": "20.10.7",
"history": [
{
"created": "2021-11-12T17:20:08.190319702Z",
"created_by": "/bin/sh -c #(nop) ADD file:8f5bc5ce64ef781adadca88e4004e17affc72e6f20dbd08b9c478def12fe1dd3 in / "
},
{
"created": "2021-11-12T17:20:08.442217528Z",
"created_by": "/bin/sh -c #(nop) CMD [\"/bin/sh\"]",
"empty_layer": true
}
],
"os": "linux",
"rootfs": {
"type": "layers",
"diff_ids": [
"sha256:eb4bde6b29a6746e0779f80a09ca6f0806de61475059f7d56d6e20f6cc2e15f7"
]
},
"config": {
"Cmd": [
"/bin/sh"
],
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Image": "sha256:7d1c1e4b291dc9519b43a2b9c9330655927f6dfde90d36ef5fd16b2ae0f28bbc"
}
}
},
"Results": [
{
"Target": "alpine:3.12 (alpine 3.12.9)",
"Class": "os-pkgs",
"Type": "alpine",
"Vulnerabilities": [
{
"VulnerabilityID": "CVE-2021-28831",
"PkgName": "busybox",
"InstalledVersion": "1.31.1-r21",
"FixedVersion": "1.32.1-r4",
"Layer": {
"Digest": "sha256:8572bc8fb8a32061648dd183b2c0451c82be1bd053a4ea8fae991436b92faebb",
"DiffID": "sha256:eb4bde6b29a6746e0779f80a09ca6f0806de61475059f7d56d6e20f6cc2e15f7"
},
"SeveritySource": "nvd",
"PrimaryURL": "https://avd.aquasec.com/nvd/cve-2021-28831",
"Title": "busybox: invalid free or segmentation fault via malformed gzip data",
"Description": "decompress_gunzip.c in BusyBox through 1.32.1 mishandles the error bit on the huft_build result pointer, with a resultant invalid free or segmentation fault, via malformed gzip data.",
"Severity": "HIGH",
"CweIDs": [
"CWE-755"
],
"CVSS": {
"nvd": {
"V2Vector": "AV:N/AC:L/Au:N/C:N/I:N/A:P",
"V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"V2Score": 5,
"V3Score": 7.5
},
"redhat": {
"V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"V3Score": 7.5
}
},
"References": [
"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28831",
"https://git.busybox.net/busybox/commit/?id=f25d254dfd4243698c31a4f3153d4ac72aa9e9bd",
"https://lists.debian.org/debian-lts-announce/2021/04/msg00001.html",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3UDQGJRECXFS5EZVDH2OI45FMO436AC4/",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/Z7ZIFKPRR32ZYA3WAA2NXFA3QHHOU6FJ/",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZASBW7QRRLY5V2R44MQ4QQM4CZIDHM2U/",
"https://security.gentoo.org/glsa/202105-09",
"https://ubuntu.com/security/notices/USN-5179-1"
],
"PublishedDate": "2021-03-19T05:15:00Z",
"LastModifiedDate": "2021-05-26T10:15:00Z"
},
{
"VulnerabilityID": "CVE-2021-28831",
"PkgName": "ssl_client",
"InstalledVersion": "1.31.1-r21",
"FixedVersion": "1.32.1-r4",
"Layer": {
"Digest": "sha256:8572bc8fb8a32061648dd183b2c0451c82be1bd053a4ea8fae991436b92faebb",
"DiffID": "sha256:eb4bde6b29a6746e0779f80a09ca6f0806de61475059f7d56d6e20f6cc2e15f7"
},
"SeveritySource": "nvd",
"PrimaryURL": "https://avd.aquasec.com/nvd/cve-2021-28831",
"Title": "busybox: invalid free or segmentation fault via malformed gzip data",
"Description": "decompress_gunzip.c in BusyBox through 1.32.1 mishandles the error bit on the huft_build result pointer, with a resultant invalid free or segmentation fault, via malformed gzip data.",
"Severity": "HIGH",
"CweIDs": [
"CWE-755"
],
"CVSS": {
"nvd": {
"V2Vector": "AV:N/AC:L/Au:N/C:N/I:N/A:P",
"V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"V2Score": 5,
"V3Score": 7.5
},
"redhat": {
"V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"V3Score": 7.5
}
},
"References": [
"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28831",
"https://git.busybox.net/busybox/commit/?id=f25d254dfd4243698c31a4f3153d4ac72aa9e9bd",
"https://lists.debian.org/debian-lts-announce/2021/04/msg00001.html",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3UDQGJRECXFS5EZVDH2OI45FMO436AC4/",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/Z7ZIFKPRR32ZYA3WAA2NXFA3QHHOU6FJ/",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZASBW7QRRLY5V2R44MQ4QQM4CZIDHM2U/",
"https://security.gentoo.org/glsa/202105-09",
"https://ubuntu.com/security/notices/USN-5179-1"
],
"PublishedDate": "2021-03-19T05:15:00Z",
"LastModifiedDate": "2021-05-26T10:15:00Z"
}
]
}
]
}
```
</details>
Here is an example predicate containing a vulnerability scan result above:
```json
{
"predicate": {
"invocation": {
"parameters": [
"--format=json"
],
"uri": "https://github.com/developer-guy/alpine/actions/runs/1071875574",
"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"
},
"result": {
"SchemaVersion": 2,
"ArtifactName": "alpine:3.12",
"ArtifactType": "container_image",
"Metadata": {
"OS": {
"Family": "alpine",
"Name": "3.12.9"
},
"ImageID": "sha256:b0925e0819214cd29937af66dbaf0e6fe239997faea60922cc890f9984512507",
"DiffIDs": [
"sha256:eb4bde6b29a6746e0779f80a09ca6f0806de61475059f7d56d6e20f6cc2e15f7"
],
"RepoTags": [
"alpine:3.12"
],
"RepoDigests": [
"alpine@sha256:d9459083f962de6bd980ae6a05be2a4cf670df6a1d898157bceb420342bec280"
],
"ImageConfig": {
"architecture": "amd64",
"container": "385e1cc96cc7482dfb6847e293bb24baecd3f48a49791b9b45e297204b160287",
"created": "2021-11-12T17:20:08.442217528Z",
"docker_version": "20.10.7",
"history": [
{
"created": "2021-11-12T17:20:08.190319702Z",
"created_by": "/bin/sh -c #(nop) ADD file:8f5bc5ce64ef781adadca88e4004e17affc72e6f20dbd08b9c478def12fe1dd3 in / "
},
{
"created": "2021-11-12T17:20:08.442217528Z",
"created_by": "/bin/sh -c #(nop) CMD [\"/bin/sh\"]",
"empty_layer": true
}
],
"os": "linux",
"rootfs": {
"type": "layers",
"diff_ids": [
"sha256:eb4bde6b29a6746e0779f80a09ca6f0806de61475059f7d56d6e20f6cc2e15f7"
]
},
"config": {
"Cmd": [
"/bin/sh"
],
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Image": "sha256:7d1c1e4b291dc9519b43a2b9c9330655927f6dfde90d36ef5fd16b2ae0f28bbc"
}
}
},
"Results": [
{
"Target": "alpine:3.12 (alpine 3.12.9)",
"Class": "os-pkgs",
"Type": "alpine",
"Vulnerabilities": [
{
"VulnerabilityID": "CVE-2021-28831",
"PkgName": "busybox",
"InstalledVersion": "1.31.1-r21",
"FixedVersion": "1.32.1-r4",
"Layer": {
"Digest": "sha256:8572bc8fb8a32061648dd183b2c0451c82be1bd053a4ea8fae991436b92faebb",
"DiffID": "sha256:eb4bde6b29a6746e0779f80a09ca6f0806de61475059f7d56d6e20f6cc2e15f7"
},
"SeveritySource": "nvd",
"PrimaryURL": "https://avd.aquasec.com/nvd/cve-2021-28831",
"Title": "busybox: invalid free or segmentation fault via malformed gzip data",
"Description": "decompress_gunzip.c in BusyBox through 1.32.1 mishandles the error bit on the huft_build result pointer, with a resultant invalid free or segmentation fault, via malformed gzip data.",
"Severity": "HIGH",
"CweIDs": [
"CWE-755"
],
"CVSS": {
"nvd": {
"V2Vector": "AV:N/AC:L/Au:N/C:N/I:N/A:P",
"V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"V2Score": 5,
"V3Score": 7.5
},
"redhat": {
"V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"V3Score": 7.5
}
},
"References": [
"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28831",
"https://git.busybox.net/busybox/commit/?id=f25d254dfd4243698c31a4f3153d4ac72aa9e9bd",
"https://lists.debian.org/debian-lts-announce/2021/04/msg00001.html",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3UDQGJRECXFS5EZVDH2OI45FMO436AC4/",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/Z7ZIFKPRR32ZYA3WAA2NXFA3QHHOU6FJ/",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZASBW7QRRLY5V2R44MQ4QQM4CZIDHM2U/",
"https://security.gentoo.org/glsa/202105-09",
"https://ubuntu.com/security/notices/USN-5179-1"
],
"PublishedDate": "2021-03-19T05:15:00Z",
"LastModifiedDate": "2021-05-26T10:15:00Z"
},
{
"VulnerabilityID": "CVE-2021-28831",
"PkgName": "ssl_client",
"InstalledVersion": "1.31.1-r21",
"FixedVersion": "1.32.1-r4",
"Layer": {
"Digest": "sha256:8572bc8fb8a32061648dd183b2c0451c82be1bd053a4ea8fae991436b92faebb",
"DiffID": "sha256:eb4bde6b29a6746e0779f80a09ca6f0806de61475059f7d56d6e20f6cc2e15f7"
},
"SeveritySource": "nvd",
"PrimaryURL": "https://avd.aquasec.com/nvd/cve-2021-28831",
"Title": "busybox: invalid free or segmentation fault via malformed gzip data",
"Description": "decompress_gunzip.c in BusyBox through 1.32.1 mishandles the error bit on the huft_build result pointer, with a resultant invalid free or segmentation fault, via malformed gzip data.",
"Severity": "HIGH",
"CweIDs": [
"CWE-755"
],
"CVSS": {
"nvd": {
"V2Vector": "AV:N/AC:L/Au:N/C:N/I:N/A:P",
"V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"V2Score": 5,
"V3Score": 7.5
},
"redhat": {
"V3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"V3Score": 7.5
}
},
"References": [
"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-28831",
"https://git.busybox.net/busybox/commit/?id=f25d254dfd4243698c31a4f3153d4ac72aa9e9bd",
"https://lists.debian.org/debian-lts-announce/2021/04/msg00001.html",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3UDQGJRECXFS5EZVDH2OI45FMO436AC4/",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/Z7ZIFKPRR32ZYA3WAA2NXFA3QHHOU6FJ/",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ZASBW7QRRLY5V2R44MQ4QQM4CZIDHM2U/",
"https://security.gentoo.org/glsa/202105-09",
"https://ubuntu.com/security/notices/USN-5179-1"
],
"PublishedDate": "2021-03-19T05:15:00Z",
"LastModifiedDate": "2021-05-26T10:15:00Z"
}
]
}
]
}
},
"metadata": {
"scanStartedOn": "2021-08-06T17:45:50.52Z",
"scanFinishedOn": "2021-08-06T17:50:50.52Z"
}
}
}
```
|