-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reference attestation for multiple equivalent images
Signed-off-by: robert-cronin <[email protected]>
- Loading branch information
1 parent
583ba15
commit 007bc05
Showing
9 changed files
with
539 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -608,3 +608,81 @@ var ITE6EOLPython = []byte(`{ | |
} | ||
} | ||
}`) | ||
|
||
// ITE6ReferenceSingle is a test document for the Reference ingestor with a single reference | ||
var ITE6ReferenceSingle = []byte(`{ | ||
"type": "https://in-toto.io/Statement/v1", | ||
"subject": [ | ||
{ | ||
"uri": "pkg:npm/[email protected]" | ||
} | ||
], | ||
"predicateType": "https://in-toto.io/attestation/reference/v0.1", | ||
"predicate": { | ||
"attester": { | ||
"id": "attester-123" | ||
}, | ||
"references": [ | ||
{ | ||
"downloadLocation": "https://example.com/downloads/pkg.tar.gz", | ||
"digest": { | ||
"sha256": "abcd1234..." | ||
}, | ||
"mediaType": "application/x-tar" | ||
} | ||
] | ||
} | ||
}`) | ||
|
||
// ITE6ReferenceMultiple is a test document for the Reference ingestor with multiple references | ||
var ITE6ReferenceMultiple = []byte(`{ | ||
"type": "https://in-toto.io/Statement/v1", | ||
"subject": [ | ||
{ | ||
"uri": "pkg:pypi/[email protected]" | ||
} | ||
], | ||
"predicateType": "https://in-toto.io/attestation/reference/v0.1", | ||
"predicate": { | ||
"attester": { | ||
"id": "attester-xyz" | ||
}, | ||
"references": [ | ||
{ | ||
"downloadLocation": "https://example.com/artifacts/python-ref1.tgz", | ||
"digest": { | ||
"sha256": "aa1111111111111111111111111111111111111111111111111111111111111111" | ||
}, | ||
"mediaType": "application/octet-stream" | ||
}, | ||
{ | ||
"downloadLocation": "https://example.com/artifacts/python-ref2.whl", | ||
"digest": { | ||
"sha256": "bb2222222222222222222222222222222222222222222222222222222222222222" | ||
}, | ||
"mediaType": "application/zip" | ||
} | ||
] | ||
} | ||
}`) | ||
|
||
// ITE6ReferenceNoSubject is a test document for the Reference ingestor with no subject provided | ||
var ITE6ReferenceNoSubject = []byte(`{ | ||
"type": "https://in-toto.io/Statement/v1", | ||
"subject": [], | ||
"predicateType": "https://in-toto.io/attestation/reference/v0.1", | ||
"predicate": { | ||
"attester": { | ||
"id": "attester-nobody" | ||
}, | ||
"references": [ | ||
{ | ||
"downloadLocation": "https://example.com/artifacts/no-subject.tgz", | ||
"digest": { | ||
"sha256": "no-subject-digest" | ||
}, | ||
"mediaType": "application/octet-stream" | ||
} | ||
] | ||
} | ||
}`) |
54 changes: 54 additions & 0 deletions
54
pkg/certifier/attestation/reference/attestation_reference.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// Copyright 2025 The GUAC Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package attestation | ||
|
||
import ( | ||
attestationv1 "github.com/in-toto/attestation/go/v1" | ||
) | ||
|
||
const ( | ||
PredicateReference = "https://in-toto.io/attestation/reference/v0.1" | ||
) | ||
|
||
// ReferenceStatement defines the statement header and the Reference predicate | ||
type ReferenceStatement struct { | ||
attestationv1.Statement | ||
// Predicate contains type specific metadata. | ||
Predicate ReferencePredicate `json:"predicate"` | ||
} | ||
|
||
// ReferencePredicate defines predicate definition of the Reference attestation | ||
type ReferencePredicate struct { | ||
Attester ReferenceAttester `json:"attester"` | ||
References []ReferenceItem `json:"references"` | ||
} | ||
|
||
// ReferenceAttester defines the attester information | ||
type ReferenceAttester struct { | ||
ID string `json:"id"` | ||
} | ||
|
||
// ReferenceItem represents an individual reference in the predicate | ||
type ReferenceItem struct { | ||
DownloadLocation string `json:"downloadLocation"` | ||
Digest ReferenceDigestItem `json:"digest"` | ||
MediaType string `json:"mediaType"` | ||
} | ||
|
||
// ReferenceDigestItem represents an individual digest in the predicate | ||
type ReferenceDigestItem struct { | ||
SHA256 string `json:"sha256"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.