Skip to content

Commit 83300a5

Browse files
feat(trace): declare the disk export is unsigned in its manifest
The export manifest now carries signed and is_attestation fields, both false, so a reader cannot mistake the on-disk evidence for a signed attestation. This satisfies the manifest declaration the spec requires (issue-3582 R-006). Refs #3582 Chainloop-Trace-Sessions: d139ac66-b95f-4920-ac38-12997996037d Signed-off-by: Matías Insaurralde <matias@chainloop.dev>
1 parent bc8bfd3 commit 83300a5

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

‎app/cli/pkg/action/trace_export.go‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,16 @@ type exportedMaterial struct {
169169

170170
// exportManifest is the top-level index of an export directory.
171171
type exportManifest struct {
172-
GeneratedAt string `json:"generated_at"`
173-
Redaction bool `json:"redaction"`
174-
Sessions []string `json:"sessions"`
175-
Materials []exportedMaterial `json:"materials"`
172+
GeneratedAt string `json:"generated_at"`
173+
// Signed and IsAttestation are always false: the export is an unsigned
174+
// evidence set, not a signed in-toto attestation, so it proves nothing on
175+
// its own. The index declares this so a reader never mistakes the export for
176+
// an attestation (spec issue-3582, R-006).
177+
Signed bool `json:"signed"`
178+
IsAttestation bool `json:"is_attestation"`
179+
Redaction bool `json:"redaction"`
180+
Sessions []string `json:"sessions"`
181+
Materials []exportedMaterial `json:"materials"`
176182
}
177183

178184
func newDiskMaterialSink(outDir string, noRedact bool, logger zerolog.Logger) *diskMaterialSink {
@@ -286,10 +292,12 @@ func (s *diskMaterialSink) writeManifest(redaction bool) error {
286292
}
287293

288294
manifest := exportManifest{
289-
GeneratedAt: time.Now().UTC().Format(time.RFC3339),
290-
Redaction: redaction,
291-
Sessions: sessions,
292-
Materials: s.materials,
295+
GeneratedAt: time.Now().UTC().Format(time.RFC3339),
296+
Signed: false,
297+
IsAttestation: false,
298+
Redaction: redaction,
299+
Sessions: sessions,
300+
Materials: s.materials,
293301
}
294302

295303
data, err := json.MarshalIndent(manifest, "", " ")

‎app/cli/pkg/action/trace_export_test.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ func TestRunTraceExportMatchesPush(t *testing.T) {
120120
data, err := os.ReadFile(filepath.Join(outDir, manifestFileName))
121121
require.NoError(t, err)
122122
require.NoError(t, json.Unmarshal(data, &manifest))
123+
// R-006: the index declares the export is unsigned and not an attestation.
124+
assert.False(t, manifest.Signed)
125+
assert.False(t, manifest.IsAttestation)
123126
assert.True(t, manifest.Redaction)
124127
assert.Contains(t, manifest.Sessions, sessionName)
125128
require.NotEmpty(t, manifest.Materials)

0 commit comments

Comments
 (0)