mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-21 14:50:53 -08:00
skip scan composer.lock in vendor dir (fanal#34)
This commit is contained in:
committed by
Teppei Fukuda
parent
a8380ab5e5
commit
f9a8f80485
@@ -3,6 +3,7 @@ package composer
|
||||
import (
|
||||
"bytes"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/aquasecurity/fanal/analyzer"
|
||||
"github.com/aquasecurity/fanal/extractor"
|
||||
@@ -28,6 +29,11 @@ func (a composerLibraryAnalyzer) Analyze(fileMap extractor.FileMap) (map[analyze
|
||||
continue
|
||||
}
|
||||
|
||||
// skip analyze files which in dependency folder
|
||||
if utils.StringInSlice(utils.COMPOSER_DEP_DIR, strings.Split(filename, utils.PathSeparator)) {
|
||||
continue
|
||||
}
|
||||
|
||||
r := bytes.NewBuffer(content)
|
||||
libs, err := composer.Parse(r)
|
||||
if err != nil {
|
||||
|
||||
@@ -7,8 +7,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
NODE_DEP_DIR = "node_modules"
|
||||
PathSeparator = fmt.Sprintf("%c", os.PathSeparator)
|
||||
NODE_DEP_DIR = "node_modules"
|
||||
COMPOSER_DEP_DIR = "vendor"
|
||||
PathSeparator = fmt.Sprintf("%c", os.PathSeparator)
|
||||
)
|
||||
|
||||
func CacheDir() string {
|
||||
|
||||
Reference in New Issue
Block a user