diff --git a/cli/slsa-verifier/main_regression_test.go b/cli/slsa-verifier/main_regression_test.go index 73d80a5..649762d 100644 --- a/cli/slsa-verifier/main_regression_test.go +++ b/cli/slsa-verifier/main_regression_test.go @@ -1802,7 +1802,7 @@ func Test_runVerifyVSA(t *testing.T) { tests := []struct { name string - attestationsPath *string + AttestationPath *string subjectDigests *[]string verifierID *string resourceURI *string @@ -1814,7 +1814,7 @@ func Test_runVerifyVSA(t *testing.T) { }{ { name: "success: gke", - attestationsPath: PointerTo("gce/v1/gke-gce-pre.bcid-vsa.jsonl"), + AttestationPath: PointerTo("gce/v1/gke-gce-pre.bcid-vsa.jsonl"), subjectDigests: PointerTo([]string{"gce_image_id:8970095005306000053"}), verifierID: PointerTo("https://bcid.corp.google.com/verifier/bcid_package_enforcer/v0.1"), resourceURI: PointerTo("gce_image://gke-node-images:gke-12615-gke1418000-cos-101-17162-463-29-c-cgpv1-pre"), @@ -1825,7 +1825,7 @@ func Test_runVerifyVSA(t *testing.T) { }, { name: "success: gke, default public key hash algo", - attestationsPath: PointerTo("gce/v1/gke-gce-pre.bcid-vsa.jsonl"), + AttestationPath: PointerTo("gce/v1/gke-gce-pre.bcid-vsa.jsonl"), subjectDigests: PointerTo([]string{"gce_image_id:8970095005306000053"}), verifierID: PointerTo("https://bcid.corp.google.com/verifier/bcid_package_enforcer/v0.1"), resourceURI: PointerTo("gce_image://gke-node-images:gke-12615-gke1418000-cos-101-17162-463-29-c-cgpv1-pre"), @@ -1836,14 +1836,14 @@ func Test_runVerifyVSA(t *testing.T) { }, { name: "fail: gke, unsupported public key hash algo", - attestationsPath: PointerTo("gce/v1/gke-gce-pre.bcid-vsa.jsonl"), + AttestationPath: PointerTo("gce/v1/gke-gce-pre.bcid-vsa.jsonl"), publicKeyPath: PointerTo("gce/v1/vsa_signing_public_key.pem"), publicKeyHashAlgo: PointerTo("SHA123"), err: serrors.ErrorInvalidHashAlgo, }, { name: "fail: gke, wrong public key hash algo", - attestationsPath: PointerTo("gce/v1/gke-gce-pre.bcid-vsa.jsonl"), + AttestationPath: PointerTo("gce/v1/gke-gce-pre.bcid-vsa.jsonl"), publicKeyPath: PointerTo("gce/v1/vsa_signing_public_key.pem"), publicKeyID: PointerTo(""), publicKeyHashAlgo: PointerTo("SHA512"), @@ -1851,7 +1851,7 @@ func Test_runVerifyVSA(t *testing.T) { }, { name: "fail: gke, wrong key id", - attestationsPath: PointerTo("gce/v1/gke-gce-pre.bcid-vsa.jsonl"), + AttestationPath: PointerTo("gce/v1/gke-gce-pre.bcid-vsa.jsonl"), publicKeyPath: PointerTo("gce/v1/vsa_signing_public_key.pem"), publicKeyID: PointerTo("my_key_id"), publicKeyHashAlgo: PointerTo("SHA256"), @@ -1865,11 +1865,11 @@ func Test_runVerifyVSA(t *testing.T) { t.Run(tt.name, func(t *testing.T) { t.Parallel() - attestationsPath := filepath.Clean(filepath.Join(TEST_DIR, "vsa", *tt.attestationsPath)) + AttestationPath := filepath.Clean(filepath.Join(TEST_DIR, "vsa", *tt.AttestationPath)) publicKeyPath := filepath.Clean(filepath.Join(TEST_DIR, "vsa", *tt.publicKeyPath)) cmd := verify.VerifyVSACommand{ - AttestationsPath: &attestationsPath, + AttestationPath: &AttestationPath, SubjectDigests: tt.subjectDigests, VerifierID: tt.verifierID, ResourceURI: tt.resourceURI, diff --git a/cli/slsa-verifier/verify.go b/cli/slsa-verifier/verify.go index de822a8..3ae48bb 100644 --- a/cli/slsa-verifier/verify.go +++ b/cli/slsa-verifier/verify.go @@ -195,7 +195,7 @@ func verifyVSACmd() *cobra.Command { Run: func(cmd *cobra.Command, args []string) { v := verify.VerifyVSACommand{ SubjectDigests: &o.SubjectDigests, - AttestationsPath: &o.AttestationsPath, + AttestationPath: &o.AttestationPath, VerifierID: &o.VerifierID, ResourceURI: &o.ResourceURI, VerifiedLevels: &o.VerifiedLevels, diff --git a/cli/slsa-verifier/verify/options.go b/cli/slsa-verifier/verify/options.go index 8c2fbe2..bebf152 100644 --- a/cli/slsa-verifier/verify/options.go +++ b/cli/slsa-verifier/verify/options.go @@ -130,7 +130,7 @@ func (o *VerifyNpmOptions) AddFlags(cmd *cobra.Command) { // VerifyVSAOptions is the top-level options for the `verifyVSA` command. type VerifyVSAOptions struct { SubjectDigests []string - AttestationsPath string + AttestationPath string VerifierID string ResourceURI string VerifiedLevels []string @@ -147,7 +147,7 @@ func (o *VerifyVSAOptions) AddFlags(cmd *cobra.Command) { cmd.Flags().StringArrayVar(&o.SubjectDigests, "subject-digest", []string{}, "the digests to be verified. Pass multiple digests by repeating the flag. e.g. :") - cmd.Flags().StringVar(&o.AttestationsPath, "attestations-path", "", + cmd.Flags().StringVar(&o.AttestationPath, "attestations-path", "", "path to a file containing the attestations") cmd.Flags().StringVar(&o.VerifierID, "verifier-id", "", diff --git a/cli/slsa-verifier/verify/verify_vsa.go b/cli/slsa-verifier/verify/verify_vsa.go index efec6a3..1a88d2b 100644 --- a/cli/slsa-verifier/verify/verify_vsa.go +++ b/cli/slsa-verifier/verify/verify_vsa.go @@ -31,7 +31,7 @@ import ( // VerifyVSACommand contains the parameters for the verify-vsa command. type VerifyVSACommand struct { SubjectDigests *[]string - AttestationsPath *string + AttestationPath *string VerifierID *string ResourceURI *string VerifiedLevels *[]string @@ -83,7 +83,7 @@ func (c *VerifyVSACommand) Exec(ctx context.Context) (*utils.TrustedAttesterID, PublicKeyID: c.PublicKeyID, PublicKeyHashAlgo: hashAlgo, } - attestations, err := os.ReadFile(*c.AttestationsPath) + attestations, err := os.ReadFile(*c.AttestationPath) if err != nil { printFailed(err) return nil, err diff --git a/verifiers/internal/vsa/vsa_test.go b/verifiers/internal/vsa/vsa_test.go index 00229ff..00331bd 100644 --- a/verifiers/internal/vsa/vsa_test.go +++ b/verifiers/internal/vsa/vsa_test.go @@ -24,7 +24,7 @@ func Test_VerifyVSA(t *testing.T) { tests := []struct { name string - attestationsPath string + AttestationPath string vsaOpts *options.VSAOpts verificationOpts *options.VerificationOpts err error @@ -147,8 +147,8 @@ func Test_VerifyVSA(t *testing.T) { for _, tt := range tests { // t.Parallel() - attestationsPath := filepath.Clean(filepath.Join(testDir, tt.attestationsPath)) - attestations, err := os.ReadFile(attestationsPath) + AttestationPath := filepath.Clean(filepath.Join(testDir, tt.AttestationPath)) + attestations, err := os.ReadFile(AttestationPath) if err != nil { t.Errorf("failed to read attestations file: %v", err) }