Skip to content

Commit

Permalink
Merge pull request google#124 from deeglaze/minver
Browse files Browse the repository at this point in the history
Allow an empty MinimumVersion
  • Loading branch information
deeglaze authored Mar 25, 2024
2 parents 0723fce + 2544dd9 commit 53e17a6
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 53e17a6

Please sign in to comment.