fix(go-vulndb): skip error, if broken several modules (#184)
This commit is contained in:
parent
32b738cf73
commit
3c40c660fd
@ -2,21 +2,23 @@ package govulndb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
"log"
|
"log"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"golang.org/x/xerrors"
|
|
||||||
|
|
||||||
"github.com/aquasecurity/vuln-list-update/utils"
|
"github.com/aquasecurity/vuln-list-update/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
vulndbURL = "https://storage.googleapis.com/go-vulndb"
|
vulndbURL = "https://storage.googleapis.com/go-vulndb"
|
||||||
vulndbDir = "go"
|
vulndbDir = "go"
|
||||||
retry = 3
|
retry = 3
|
||||||
|
notFoundError = "HTTP error. status code: 404"
|
||||||
)
|
)
|
||||||
|
|
||||||
type options struct {
|
type options struct {
|
||||||
@ -123,6 +125,10 @@ func (c VulnDB) parseModuleEntries(baseURL *url.URL, moduleName string) ([]Entry
|
|||||||
|
|
||||||
res, err := utils.FetchURL(pkgURL.String(), "", c.retry)
|
res, err := utils.FetchURL(pkgURL.String(), "", c.retry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if strings.Contains(err.Error(), notFoundError) {
|
||||||
|
log.Println(fmt.Sprintf("module %s not found", moduleName))
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
return nil, xerrors.Errorf("unable to query %s advisory: %w", moduleName, err)
|
return nil, xerrors.Errorf("unable to query %s advisory: %w", moduleName, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user