From 0c9fe651e67ec1bbfe0a80d13b9c5bbe84c4141f Mon Sep 17 00:00:00 2001 From: Vivek Kumar Sahu Date: Tue, 6 Feb 2024 10:52:00 +0530 Subject: [PATCH] remove old format rekor response test --- test/e2e_test.go | 52 +++++------------------------------------------- 1 file changed, 5 insertions(+), 47 deletions(-) diff --git a/test/e2e_test.go b/test/e2e_test.go index 1b41c2713c9..75821b58f13 100644 --- a/test/e2e_test.go +++ b/test/e2e_test.go @@ -930,7 +930,7 @@ func TestAttachWithRFC3161Timestamp(t *testing.T) { must(verifyKeylessTSA(imgName, file.Name(), true, true), t) } -func TestAttachWithRekorBundle(t *testing.T) { +func TestAttachWithRekorResponse(t *testing.T) { ctx := context.Background() repo, stop := reg(t) @@ -968,30 +968,14 @@ func TestAttachWithRekorBundle(t *testing.T) { certchainRef := mkfile(string(append(pemSub[:], pemRoot[:]...)), td, t) - localRekorBundle := &bundle.RekorBundle{ - SignedEntryTimestamp: strfmt.Base64("MEUCIEDcarEwRYkrxE9ne+kzEVvUhnWaauYzxhUyXOLy1hwAAiEA4VdVCvNRs+D/5o33C2KBy+q2YX3lP4Y7nqRFU+K3hi0="), - Payload: bundle.RekorPayload{ - Body: "REMOVED", - IntegratedTime: 1631646761, - LogIndex: 693591, - LogID: "c0d23d6ad406973f9559f3ba2d1ca01f84147d8ffc5b8445c224f98b9591801d", - }, - } - - localPayload := cosign.LocalSignedPayload{ - Base64Signature: b64signature, - Cert: string(pemLeaf), - Bundle: localRekorBundle, - } - rekorResponse := make(cosign.RekorResponse) - logIndexValue := int64(63771522) - rootHash := "5bbff4e9f8034a33b102996271c0e01b87caa83c44c46e893b47b81467fd808c" - treeSize := int64(64319120) - checkPoint := "rekor.sigstore.dev - 2605736670972794746\n64319120\nW7/06fgDSjOxApliccDgG4fKqDxExG6JO0e4FGf9gIw=\nTimestamp: 1706845443714164712\n\n— rekor.sigstore.dev wNI9ajBFAiEAnduIhP1Jjz8E0ZAP8e1x0aKqzJCtmWZyV1mRJB/PlOoCIBoeHdjeONYmxlD2Za7sU0NeK/60skNnwoelsa3m2M8z\n" integratedTime := int64(1706680021) logID := "c0d23d6ad406973f9559f3ba2d1ca01f84147d8ffc5b8445c224f98b9591801d" logIndex := int64(67934953) + checkPoint := "rekor.sigstore.dev - 2605736670972794746\n64319120\nW7/06fgDSjOxApliccDgG4fKqDxExG6JO0e4FGf9gIw=\nTimestamp: 1706845443714164712\n\n— rekor.sigstore.dev wNI9ajBFAiEAnduIhP1Jjz8E0ZAP8e1x0aKqzJCtmWZyV1mRJB/PlOoCIBoeHdjeONYmxlD2Za7sU0NeK/60skNnwoelsa3m2M8z\n" + logIndexValue := int64(63771522) + rootHash := "5bbff4e9f8034a33b102996271c0e01b87caa83c44c46e893b47b81467fd808c" + treeSize := int64(64319120) logEntry := models.LogEntryAnon{ Body: "eyJhcGlWZXJzaW9uIjoiMC4wLjEiLCJraW5kIjoiaGFzaGVkcmVrb3JkIiwic3BlYyI6eyJkYXRhIjp7Imhhc2giOnsiYWxnb3JpdGhtIjoic2hhMjU2IiwidmFsdWUiOiI3YTIxODlmNzNlYTVkYmVlMmQ1NjgxMGU4NjBjZDgxNjdlYTFiMGYzMTdkZGRjMmU0YzE2NmU3ZDY4NzUzOGYwIn19LCJzaWduYXR1cmUiOnsiY29udGVudCI6Ik1FUUNJQlZtMVc1YlNSOXBTYVFyRWRVL2dOeEZuaVQzMCs4RGp5SG9naERwWHM3b0FpQXMyby82c3l2bzRaTDd3YVUrMXBNeVIvR1dNWlZTaUdzRm5hSm04ZDZZZ0E9PSIsInB1YmxpY0tleSI6eyJjb250ZW50IjoiTFMwdExTMUNSVWRKVGlCUVZVSk1TVU1nUzBWWkxTMHRMUzBLVFVacmQwVjNXVWhMYjFwSmVtb3dRMEZSV1VsTGIxcEplbW93UkVGUlkwUlJaMEZGUldGSWNHUmhZVE13ZEVOaVMxbG5lalpyUlhsQmNqTXJORmh5TWdwb1pWUjNaM2hQVVVrM2QwcDRiVWhIWW5OU1dYcEJWbFJyUVN0RGIzVjZUblZrTUc5eGRuUTRXVXB0Tm5CQlFUZG5SbUZFUkZGU05EUlJQVDBLTFMwdExTMUZUa1FnVUZWQ1RFbERJRXRGV1MwdExTMHRDZz09In19fX0=", @@ -1011,43 +995,17 @@ func TestAttachWithRekorBundle(t *testing.T) { rekorResponse["24296fb24b8ad77a8ada322cbba201d23b88acd2f68b29e358668e3aef36306ddb2c253ca0dc9ede"] = logEntry - jsonBundle, err := json.Marshal(localPayload) - if err != nil { - t.Fatal(err) - } - jsonRekorBundle, err := json.Marshal(localRekorBundle) - if err != nil { - t.Fatal(err) - } jsonRekorResponsePath, err := json.Marshal(rekorResponse) if err != nil { t.Fatal(err) } - bundlePath := filepath.Join(td, "bundle.json") - if err := os.WriteFile(bundlePath, jsonBundle, 0644); err != nil { - t.Fatal(err) - } - - rekorBundlePath := filepath.Join(td, "bundle2.json") - if err := os.WriteFile(rekorBundlePath, jsonRekorBundle, 0644); err != nil { - t.Fatal(err) - } - rekorResponsePath := filepath.Join(td, "rekor-response.json") if err := os.WriteFile(rekorResponsePath, jsonRekorResponsePath, 0644); err != nil { t.Fatal(err) } // Upload it! - err = attach.SignatureCmd(ctx, options.RegistryOptions{}, sigRef, payloadref, pemleafRef, certchainRef, "", bundlePath, imgName) - if err != nil { - t.Fatal(err) - } - err = attach.SignatureCmd(ctx, options.RegistryOptions{}, sigRef, payloadref, pemleafRef, certchainRef, "", rekorBundlePath, imgName) - if err != nil { - t.Fatal(err) - } err = attach.SignatureCmd(ctx, options.RegistryOptions{}, sigRef, payloadref, pemleafRef, certchainRef, "", rekorResponsePath, imgName) if err != nil { t.Fatal(err)