mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-20 20:07:52 +02:00
Update slsa validation to not validate version when running in github actions, since the one in actions isn't associated with a released version
This commit is contained in:
parent
c3c74970b0
commit
c918bcd3cb
2
.github/workflows/slsa-releaser.yml
vendored
2
.github/workflows/slsa-releaser.yml
vendored
@ -214,7 +214,7 @@ jobs:
|
||||
run: |
|
||||
go build; ./hishtory install
|
||||
# curl https://hishtory.dev/install.py | python3 -
|
||||
./hishtory validate-binary v0.`cat VERSION` hishtory-linux-amd64 hishtory-linux-amd64.intoto.jsonl
|
||||
./hishtory validate-binary hishtory-linux-amd64 hishtory-linux-amd64.intoto.jsonl
|
||||
# hishtory validate-binary v0.`cat VERSION` hishtory-linux-amd64 hishtory-linux-amd64.intoto.jsonl
|
||||
# TODO: Validate other binaries here
|
||||
|
@ -19,7 +19,6 @@ import (
|
||||
"github.com/ddworken/hishtory/client/lib"
|
||||
"github.com/ddworken/hishtory/shared"
|
||||
"github.com/spf13/cobra"
|
||||
"golang.org/x/mod/semver"
|
||||
)
|
||||
|
||||
var updateCmd = &cobra.Command{
|
||||
@ -34,23 +33,19 @@ var validateBinaryCmd = &cobra.Command{
|
||||
Use: "validate-binary",
|
||||
Hidden: true,
|
||||
Short: "[Test Only] Validate the given binary for SLSA compliance",
|
||||
Args: cobra.ExactArgs(3),
|
||||
Args: cobra.ExactArgs(2),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
ctx := hctx.MakeContext()
|
||||
version := strings.TrimSpace(args[0])
|
||||
if !semver.IsValid(version) {
|
||||
lib.CheckFatalError(fmt.Errorf("specified version %#v is not a valid version", version))
|
||||
}
|
||||
binaryPath := args[1]
|
||||
attestationPath := args[2]
|
||||
binaryPath := args[0]
|
||||
attestationPath := args[1]
|
||||
isMacOs, err := cmd.Flags().GetBool("is_macos")
|
||||
lib.CheckFatalError(err)
|
||||
if isMacOs {
|
||||
macOsUnsignedBinaryPath, err := cmd.Flags().GetString("macos_unsigned_binary")
|
||||
lib.CheckFatalError(err)
|
||||
lib.CheckFatalError(verifyBinaryAgainstUnsignedBinaryForMac(ctx, binaryPath, macOsUnsignedBinaryPath, attestationPath, version))
|
||||
lib.CheckFatalError(verifyBinaryAgainstUnsignedBinaryForMac(ctx, binaryPath, macOsUnsignedBinaryPath, attestationPath, ""))
|
||||
} else {
|
||||
lib.CheckFatalError(lib.VerifyBinary(ctx, binaryPath, attestationPath, version))
|
||||
lib.CheckFatalError(lib.VerifyBinary(ctx, binaryPath, attestationPath, ""))
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -20,7 +20,9 @@ func verify(ctx context.Context, provenance []byte, artifactHash, source, branch
|
||||
ExpectedSourceURI: source,
|
||||
ExpectedBranch: &branch,
|
||||
ExpectedDigest: artifactHash,
|
||||
ExpectedVersionedTag: &versionTag,
|
||||
}
|
||||
if versionTag != "" {
|
||||
provenanceOpts.ExpectedVersionedTag = &versionTag
|
||||
}
|
||||
builderOpts := &options.BuilderOpts{}
|
||||
_, _, err := verifiers.Verify(ctx, provenance, artifactHash, provenanceOpts, builderOpts)
|
||||
|
Loading…
x
Reference in New Issue
Block a user