Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pkg/cmd/release/shared/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ type Verifier interface {
}

type AttestationVerifier struct {
AttClient api.Client
HttpClient *http.Client
IO *iostreams.IOStreams
AttClient api.Client
HttpClient *http.Client
IO *iostreams.IOStreams
TrustedRoot string
}

func (v *AttestationVerifier) VerifyAttestation(art *artifact.DigestedArtifact, att *api.Attestation) (*verification.AttestationProcessingResult, error) {
Expand All @@ -41,6 +42,7 @@ func (v *AttestationVerifier) VerifyAttestation(art *artifact.DigestedArtifact,
Logger: att_io.NewHandler(v.IO),
NoPublicGood: true,
TrustDomain: td,
TrustedRoot: v.TrustedRoot,
})
if err != nil {
return nil, err
Expand Down
10 changes: 7 additions & 3 deletions pkg/cmd/release/verify-asset/verify_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type VerifyAssetOptions struct {
BaseRepo ghrepo.Interface
Exporter cmdutil.Exporter
AssetFilePath string
TrustedRoot string
}

type VerifyAssetConfig struct {
Expand Down Expand Up @@ -93,9 +94,10 @@ func NewCmdVerifyAsset(f *cmdutil.Factory, runF func(*VerifyAssetConfig) error)
attClient := api.NewLiveClient(httpClient, baseRepo.RepoHost(), att_io.NewHandler(io))

attVerifier := &shared.AttestationVerifier{
AttClient: attClient,
HttpClient: httpClient,
IO: io,
AttClient: attClient,
HttpClient: httpClient,
IO: io,
TrustedRoot: opts.TrustedRoot,
}

config := &VerifyAssetConfig{
Expand All @@ -114,6 +116,8 @@ func NewCmdVerifyAsset(f *cmdutil.Factory, runF func(*VerifyAssetConfig) error)
},
}
cmdutil.AddFormatFlags(cmd, &opts.Exporter)
cmd.Flags().StringVarP(&opts.TrustedRoot, "custom-trusted-root", "", "", "Path to a trusted_root.jsonl file; likely for offline verification.")
cmd.Flags().MarkHidden("custom-trusted-root")

return cmd
}
Expand Down
16 changes: 10 additions & 6 deletions pkg/cmd/release/verify/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ import (
)

type VerifyOptions struct {
TagName string
BaseRepo ghrepo.Interface
Exporter cmdutil.Exporter
TagName string
BaseRepo ghrepo.Interface
Exporter cmdutil.Exporter
TrustedRoot string
}

type VerifyConfig struct {
Expand Down Expand Up @@ -87,9 +88,10 @@ func NewCmdVerify(f *cmdutil.Factory, runF func(config *VerifyConfig) error) *co
attClient := api.NewLiveClient(httpClient, baseRepo.RepoHost(), att_io.NewHandler(io))

attVerifier := &shared.AttestationVerifier{
AttClient: attClient,
HttpClient: httpClient,
IO: io,
AttClient: attClient,
HttpClient: httpClient,
IO: io,
TrustedRoot: opts.TrustedRoot,
}

config := &VerifyConfig{
Expand All @@ -107,6 +109,8 @@ func NewCmdVerify(f *cmdutil.Factory, runF func(config *VerifyConfig) error) *co
},
}
cmdutil.AddFormatFlags(cmd, &opts.Exporter)
cmd.Flags().StringVarP(&opts.TrustedRoot, "custom-trusted-root", "", "", "Path to a trusted_root.jsonl file; likely for offline verification.")
cmd.Flags().MarkHidden("custom-trusted-root")

return cmd
}
Expand Down
Loading