Skip to content

Commit

Permalink
hack: temporary workaround for github org name migration
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Feb 11, 2025
1 parent 99e2046 commit ea24ac3
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions sigstore/sigstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
_ "embed"
"encoding/hex"
"fmt"
"strings"

protobundle "github.com/sigstore/protobuf-specs/gen/pb-go/bundle/v1"
"github.com/sigstore/sigstore-go/pkg/bundle"
Expand Down Expand Up @@ -70,13 +71,30 @@ func VerifyAttestation(
return nil, fmt.Errorf("creating certificate identity: %w", err)
}

//
// WARNING: This is a temporary hack to get around our GitHub repo migration from tinfoilanalytics to tinfoilsh.
//
fallbackCertID, err := verify.NewShortCertificateIdentity(
oidcIssuer,
"",
"",
"^https://github.com/"+strings.ReplaceAll(repo, "tinfoilsh", "tinfoilanalytics")+"/.github/workflows/.*@refs/tags/*",
)
if err != nil {
return nil, fmt.Errorf("creating certificate identity: %w", err)
}

digest, err := hex.DecodeString(hexDigest)
if err != nil {
return nil, fmt.Errorf("decoding hex digest: %w", err)
}
result, err := verifier.Verify(&b, verify.NewPolicy(
verify.WithArtifactDigest("sha256", digest),
verify.WithCertificateIdentity(certID)),
result, err := verifier.Verify(
&b,
verify.NewPolicy(
verify.WithArtifactDigest("sha256", digest),
verify.WithCertificateIdentity(certID),
verify.WithCertificateIdentity(fallbackCertID),
),
)
if err != nil {
return nil, fmt.Errorf("verifying: %w", err)
Expand Down

0 comments on commit ea24ac3

Please sign in to comment.