v0.x: the signing defaults move onto the tool's signing config¶
Spec 0225
finishes what the checksum move in
the forge extraction
started. A tool's signing baseline is a field on props.Tool.Signing, not a
process-wide variable.
What changed¶
The self-updater no longer reads these variables on
gitlab.com/phpboyscout/go/signing/verify:
DefaultRequireSignatureDefaultKeySourceDefaultRequireExternalCrosscheckDefaultExternalKeyEmail
It reads four fields on props.Tool.Signing instead, beside RequireChecksum.
Runtime update.* config still overrides each one, and the framework defaults
are unchanged (false, "both", false, "").
A tool that still sets an old variable is refused. Execute and the root
pre-run fail with ErrOldSigningDefault before any command runs, --help
included. The error names each variable it found and the field to set instead.
Running on would have silently dropped the requirement the variable asked for.
Before and after¶
-verify.DefaultRequireSignature = true
+Signing: props.SigningConfig{RequireSignature: props.BoolPtr(true)},
-verify.DefaultRequireExternalCrosscheck = true
+Signing: props.SigningConfig{RequireExternalCrosscheck: props.BoolPtr(true)},
-verify.DefaultExternalKeyEmail = "[email protected]"
+Signing: props.SigningConfig{ExternalKeyEmail: "[email protected]"},
The two booleans are pointers, as RequireChecksum is, so unset and explicitly
false stay distinct. A blank string counts as unset.
When the refusal sees a variable¶
The check reads the variables in Execute, and again in the root pre-run for a
tool that runs the command itself. So it sees one set before then: a
package-level initialiser, an init(), or main() before Execute. It does
not see:
- a variable set later, from a pre-run or a command;
- a tool that builds an updater without a root, through
setup.NewOfflineUpdater.
Either way the variable does nothing, because gtb no longer reads it. Search
the tool for verify.Default to find them.
A variable set to its own default, such as DefaultKeySource = "both", is not
refused, because it changes nothing.
Generated projects¶
pkg/cmd/root/signing.go is no longer generated. The manifest's signing
block is unchanged, and the generator now writes its values into the root's
Signing: block, only where they differ from the framework default.
gtb regenerate project removes an old signing.go, and so does
gtb enable signing, gtb disable signing or gtb set on a signing key.
A .gtb/ignore rule that keeps pkg/cmd/root/signing.go makes enable,
disable and a signing set refuse, because they would remove it.
gtb regenerate project keeps the file and warns. Remove the rule.
A rule that keeps pkg/cmd/root/cmd.go while signing is on is checked against
the manifest. If the kept root would ship a weaker posture (a required
signature or cross-check left off, or a key source or external key email that
differs), every command that writes the project refuses before writing
anything, and names each field with the value to set by hand. See
configuring the generator ignore file.