improve ruby comparison version check. (#552)

* Implemented ruby comparison version check.

* Added semver package to validate and check version

* Added more tests

* Replaced go-version with semver

* Removing go-version from dependency

* Added check for ruby gem version format

* Updated semver model and patch rewrite process

* Refactoring
This commit is contained in:
rahul2393
2020-07-19 20:33:56 +05:30
committed by GitHub
parent 43085a80bc
commit 6eebed33b2
13 changed files with 196 additions and 30 deletions

View File

@@ -8,8 +8,8 @@ import (
"golang.org/x/xerrors"
"github.com/Masterminds/semver/v3"
"github.com/aquasecurity/trivy/pkg/scanner/utils"
"github.com/knqyf263/go-version"
)
type Advisory struct {
@@ -22,7 +22,7 @@ func NewAdvisory() *Advisory {
}
}
func (s *Advisory) DetectVulnerabilities(pkgName string, pkgVer *version.Version) ([]types.DetectedVulnerability, error) {
func (s *Advisory) DetectVulnerabilities(pkgName string, pkgVer *semver.Version) ([]types.DetectedVulnerability, error) {
advisories, err := s.vs.Get(pkgName)
if err != nil {
return nil, xerrors.Errorf("failed to get python advisories: %w", err)