Skip to content

Commit 455ce65

Browse files
committed
fix(): Don't parse CVE tags
The libxml, libxslt repos had tags that started with `CVE-` and used calendar tags. When parsed into sematic versioning the numbers would be high causing the version to be misreported.
1 parent 5f20869 commit 455ce65

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

version.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package reqcheck
77
import (
88
"fmt"
99
"regexp"
10+
"strings"
1011

1112
"github.com/Masterminds/semver"
1213
"github.com/sirupsen/logrus"
@@ -15,6 +16,10 @@ import (
1516
var versionMatcher = regexp.MustCompile(`^[a-zA-Z-_.]*(?P<major>\d+)[._-](?P<minor>\d*)[._-]*(?P<patch>\d*)[._-]*(?P<prerelease>[a-zA-Z-_.]*)(?P<preversion>\d*)$`)
1617

1718
func generateVersion(tag string, matcher *regexp.Regexp) *semver.Version {
19+
if strings.HasPrefix(tag, "CVE-") {
20+
return nil
21+
}
22+
1823
semVer, err := semver.NewVersion(tag)
1924
if err == nil {
2025
return semVer

0 commit comments

Comments
 (0)