Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the "upload" flag for "cosign initialize" #1201

Merged
merged 1 commit into from
Dec 14, 2021
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
7 changes: 3 additions & 4 deletions cmd/cosign/cli/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ func Initialize() *cobra.Command {
Long: `Initializes SigStore root to retrieve trusted certificate and key targets for verification.

The following options are used by default:
- The current trusted Sigstore TUF root is embedded inside cosign at the time of release.
- SigStore remote TUF repository is pulled from the GCS mirror at sigstore-tuf-root.
- A default threshold of 3 root signatures is used.
- The current trusted Sigstore TUF root is embedded inside cosign at the time of release.
- SigStore remote TUF repository is pulled from the GCS mirror at sigstore-tuf-root.

To provide an out-of-band trusted initial root.json, use the -root flag with a file or URL reference.
This will enable you to point cosign to a separate TUF root.
Expand All @@ -53,7 +52,7 @@ cosign initialize -root <url>
# initialize with an out-of-band root key file and custom repository mirror.
cosign initialize -mirror <url> -root <url>`,
RunE: func(cmd *cobra.Command, args []string) error {
return initialize.DoInitialize(cmd.Context(), o.Root, o.Mirror, o.Threshold)
return initialize.DoInitialize(cmd.Context(), o.Root, o.Mirror)
},
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/cosign/cli/initialize/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/theupdateframework/go-tuf/client"
)

func DoInitialize(ctx context.Context, root, mirror string, threshold int) error {
func DoInitialize(ctx context.Context, root, mirror string) error {
// Get the initial trusted root contents.
var rootFileBytes []byte
var err error
Expand All @@ -48,5 +48,5 @@ func DoInitialize(ctx context.Context, root, mirror string, threshold int) error
}

// Initialize and update the local SigStore root.
return tuf.Init(ctx, rootFileBytes, remote, threshold)
return tuf.Init(ctx, rootFileBytes, remote)
}
8 changes: 2 additions & 6 deletions cmd/cosign/cli/options/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ import (

// InitializeOptions is the top level wrapper for the initialize command.
type InitializeOptions struct {
Mirror string
Root string
Threshold int
Mirror string
Root string
}

var _ Interface = (*InitializeOptions)(nil)
Expand All @@ -35,7 +34,4 @@ func (o *InitializeOptions) AddFlags(cmd *cobra.Command) {

cmd.Flags().StringVar(&o.Root, "root", "",
"path to trusted initial root. defaults to embedded root")

cmd.Flags().IntVar(&o.Threshold, "upload", 3,
"threshold of root key signers")
}
6 changes: 2 additions & 4 deletions doc/cosign_initialize.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/cosign/tuf/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func downloadRemoteTarget(name string, c *client.Client, out client.Destination)

// Instantiates the global TUF client. Uses the embedded (by default trusted) root in cosign
// unless a custom root is provided. This will always perform a remote call to update.
func Init(ctx context.Context, altRootBytes []byte, remote client.RemoteStore, threshold int) error {
func Init(ctx context.Context, altRootBytes []byte, remote client.RemoteStore) error {
rootClient, err := RootClient(ctx, remote, altRootBytes)
if err != nil {
return errors.Wrap(err, "initializing root client")
Expand Down