Skip to content

Duplicated attestation? #1779

@pstoeckle

Description

@pstoeckle

Describe the bug
When I use cosign download attestation with a platform, I get the SBOM twice... Is there a reason for this? 😅

To Reproduce

Assuming that cosign and jq are installed:

cosign download attestation \
    --platform linux/amd64 \
    gcr.io/distroless/static-debian12:debug-nonroot@sha256:3d0f463de06b7ddff27684ec3bfd0b54a425149d0f8685308b1fdf297b0265e9 \
      | jq -r .payload \
      | base64 -d \
      | jq -r '.' > payload.json

creates this payload.json

{
  "_type": "https://in-toto.io/Statement/v0.1",
  "predicateType": "https://spdx.dev/Document",
  "subject": [
    {
      "name": "gcr.io/distroless/static-debian12",
      "digest": {
        "sha256": "e14f4c00d388743628c674d88e44ac51895d7bc074a37e805eaf141cdbfa5ff1"
      }
    }
  ],
  "predicate": "{\"spdxVersion\":\"SPDX-2.3\",\"dataLicense\":\"CC0-1.0\",...}"
}
{
  "_type": "https://in-toto.io/Statement/v0.1",
  "predicateType": "https://spdx.dev/Document",
  "subject": [
    {
      "name": "gcr.io/distroless/static-debian12",
      "digest": {
        "sha256": "e14f4c00d388743628c674d88e44ac51895d7bc074a37e805eaf141cdbfa5ff1"
      }
    }
  ],
  "predicate": "{\"spdxVersion\":\"SPDX-2.3\",\"dataLicense\":\"CC0-1.0\",...}"
}

Expected behavior

The payload.json should look like this

{
  "_type": "https://in-toto.io/Statement/v0.1",
  "predicateType": "https://spdx.dev/Document",
  "subject": [
    {
      "name": "gcr.io/distroless/static-debian12",
      "digest": {
        "sha256": "e14f4c00d388743628c674d88e44ac51895d7bc074a37e805eaf141cdbfa5ff1"
      }
    }
  ],
  "predicate": "{\"spdxVersion\":\"SPDX-2.3\",\"dataLicense\":\"CC0-1.0\",...}"
}

Console Output
If applicable, add information from your container run

Additional context

$ cosign version
cosign version
  ______   ______        _______. __    _______ .__   __.
 /      | /  __  \      /       ||  |  /  _____||  \ |  |
|  ,----'|  |  |  |    |   (----`|  | |  |  __  |   \|  |
|  |     |  |  |  |     \   \    |  | |  | |_ | |  . `  |
|  `----.|  `--'  | .----)   |   |  | |  |__| | |  |\   |
 \______| \______/  |_______/    |__|  \______| |__| \__|
cosign: A tool for Container Signing, Verification and Storage in an OCI registry.

GitVersion:    v2.4.3
GitCommit:     6a7abbf3ae7eb6949883a80c8f6007cc065d2dfb
GitTreeState:  clean
BuildDate:     2025-02-19T19:34:52Z
GoVersion:     go1.23.6
Compiler:      gc
Platform:      darwin/arm64
$ jq --version
jq-1.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions