You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for SigningConfig in sign/attest (#4371)
* Add support for SigningConfig in sign/attest
This will indirectly add support for signing with Rekor v2, since
signing will be handled by sigstore-go rather than Cosign.
This also brings sign/attest up to par with sign-blob/attest-blob with
respect to signing with a key and providing a trusted root when
providing a signing config.
This feature is gated behind one of two signing config flags, which in a
later version of Cosign will be flipped to on by default.
Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
* Address review comments
--signing-config and --use-signing-config are now mutually exclusive.
TrustedMaterial and SigningConfig are set in the same line as fetching
the trusted root and signing config.
Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
---------
Signed-off-by: Hayden <8418760+haydentherapper@users.noreply.github.com>
ui.Warnf(context.Background(), "Could not fetch trusted_root.json from the TUF repository. Continuing with individual targets. Error from TUF: %v", err)
119
+
}
120
+
}
121
+
}
122
+
123
+
if (o.UseSigningConfig||o.SigningConfigPath!="") &&!o.NewBundleFormat {
124
+
returnfmt.Errorf("must provide --new-bundle-format with --signing-config or --use-signing-config")
125
+
}
126
+
ifo.UseSigningConfig {
127
+
ko.SigningConfig, err=cosign.SigningConfig()
106
128
iferr!=nil {
107
-
ui.Warnf(context.Background(), "Could not fetch trusted_root.json from the TUF repository. Continuing with individual targets. Error from TUF: %v", err)
129
+
returnfmt.Errorf("error getting signing config from TUF: %w", err)
ui.Warnf(context.Background(), "Could not fetch trusted_root.json from the TUF repository. Continuing with individual targets. Error from TUF: %v", err)
107
107
}
108
-
ko.TrustedMaterial=trustedMaterial
109
108
}
110
109
}
111
110
if (o.UseSigningConfig||o.SigningConfigPath!="") &&o.BundlePath=="" {
112
111
returnfmt.Errorf("must provide --bundle with --signing-config or --use-signing-config")
113
112
}
114
113
ifo.UseSigningConfig {
115
-
signingConfig, err:=cosign.SigningConfig()
114
+
ko.SigningConfig, err=cosign.SigningConfig()
116
115
iferr!=nil {
117
116
returnfmt.Errorf("error getting signing config from TUF: %w", err)
"whether to use a TUF-provided signing config for the service URLs. Must set --new-bundle-format, which will store verification material in the new format")
Copy file name to clipboardExpand all lines: cmd/cosign/cli/options/sign.go
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,9 @@ type SignOptions struct {
43
43
SignContainerIdentitystring
44
44
RecordCreationTimestampbool
45
45
NewBundleFormatbool
46
+
UseSigningConfigbool
47
+
SigningConfigPathstring
48
+
TrustedRootPathstring
46
49
47
50
RekorRekorOptions
48
51
FulcioFulcioOptions
@@ -139,5 +142,18 @@ func (o *SignOptions) AddFlags(cmd *cobra.Command) {
139
142
140
143
cmd.Flags().BoolVar(&o.RecordCreationTimestamp, "record-creation-timestamp", false, "set the createdAt timestamp in the signature artifact to the time it was created; by default, cosign sets this to the zero value")
141
144
145
+
// TODO: have this default to true as a breaking change
142
146
cmd.Flags().BoolVar(&o.NewBundleFormat, "new-bundle-format", false, "expect the signature/attestation to be packaged in a Sigstore bundle")
147
+
148
+
// TODO: have this default to true as a breaking change
"whether to use a TUF-provided signing config for the service URLs. Must set --new-bundle-format, which will store verification material in the new format")
ui.Warnf(context.Background(), "Could not fetch trusted_root.json from the TUF repository. Continuing with individual targets. Error from TUF: %v", err)
149
+
}
150
+
}
151
+
}
152
+
153
+
if (o.UseSigningConfig||o.SigningConfigPath!="") &&!o.NewBundleFormat {
154
+
returnfmt.Errorf("must provide --new-bundle-format with --signing-config or --use-signing-config")
155
+
}
156
+
ifo.UseSigningConfig {
157
+
ko.SigningConfig, err=cosign.SigningConfig()
136
158
iferr!=nil {
137
-
ui.Warnf(context.Background(), "Could not fetch trusted_root.json from the TUF repository. Continuing with individual targets. Error from TUF: %v", err)
159
+
returnfmt.Errorf("error getting signing config from TUF: %w", err)
0 commit comments