Skip to content

Commit

Permalink
Allow an empty MinimumVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
deeglaze committed Mar 25, 2024
1 parent 0723fce commit 2544dd9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,12 @@ func PolicyToOptions(policy *cpb.Policy) (*Options, error) {
if policy.GetMinimumBuild() > 255 {
return nil, fmt.Errorf("minimum_build is %d. Expect 0-255", policy.GetMinimumBuild())
}
minVersion, err := parseVersion(policy.GetMinimumVersion())
if err != nil {
return nil, fmt.Errorf("invalid minimum_version, %q: %v", policy.GetMinimumVersion(), err)
minVersion := uint16(0) // Allow an empty minimum version to mean "0.0"
if policy.GetMinimumVersion() != "" {
minVersion, err = parseVersion(policy.GetMinimumVersion())
if err != nil {
return nil, fmt.Errorf("invalid minimum_version, %q: %v", policy.GetMinimumVersion(), err)
}
}
for _, authorKeyHash := range policy.GetTrustedAuthorKeyHashes() {
if err := lengthCheck("trusted_author_key_hashes", abi.AuthorKeyDigestSize, authorKeyHash); err != nil {
Expand Down

0 comments on commit 2544dd9

Please sign in to comment.