chore: publish IntegraCI build modules dafcf6d0e87d
This commit is contained in:
1 parent
395617ae63
commit
e6bc5d215e
6 files changed
+60
-14
No files matched your search
@@ -169,3 +169,21 @@ func CheckRegex(flag, re string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnpublishedSignatureNotice is printed (and returned in SignResult.Notice)
|
||||
// by the gpg and in-toto cases of SignMethod. Both produce their output inside
|
||||
// a throwaway container and neither pushes nor exports it, so no one (the
|
||||
// platform or a human) can check that signature afterwards. The step keeps
|
||||
// succeeding (owner rule 2026-11-08: pipelines already rendered with these
|
||||
// methods must keep working); it just stops claiming a usable signature.
|
||||
// Empty for every other method.
|
||||
func UnpublishedSignatureNotice(method string) string {
|
||||
switch method {
|
||||
case "gpg", "in-toto":
|
||||
return "WARNING: --method " + method + " produced a signature that is NOT published " +
|
||||
"(not pushed to the registry, not exported), so it cannot be verified by the " +
|
||||
"platform or anyone else. A deploy that requires a signed artifact will be refused. " +
|
||||
"Use --method cosign for a signature the platform verifies."
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -200,3 +200,17 @@ func TestRekorURLRefusesUnsafeValues(t *testing.T) {
|
||||
t.Fatalf("a plain https URL must pass: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnpublishedSignatureNotice(t *testing.T) {
|
||||
for _, m := range []string{"gpg", "in-toto"} {
|
||||
n := UnpublishedSignatureNotice(m)
|
||||
if !strings.Contains(n, "NOT published") || !strings.Contains(n, m) {
|
||||
t.Fatalf("%s: notice must say the signature is not published and name the method, got %q", m, n)
|
||||
}
|
||||
}
|
||||
for _, m := range []string{"cosign", "notation", "none", ""} {
|
||||
if n := UnpublishedSignatureNotice(m); n != "" {
|
||||
t.Fatalf("%s publishes a signature (or claims none); want no notice, got %q", m, n)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user