mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-22 07:10:41 -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 (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/aquasecurity/fanal/analyzer"
|
"github.com/aquasecurity/fanal/analyzer"
|
||||||
"github.com/aquasecurity/fanal/extractor"
|
"github.com/aquasecurity/fanal/extractor"
|
||||||
@@ -28,6 +29,11 @@ func (a composerLibraryAnalyzer) Analyze(fileMap extractor.FileMap) (map[analyze
|
|||||||
continue
|
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)
|
r := bytes.NewBuffer(content)
|
||||||
libs, err := composer.Parse(r)
|
libs, err := composer.Parse(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
NODE_DEP_DIR = "node_modules"
|
NODE_DEP_DIR = "node_modules"
|
||||||
PathSeparator = fmt.Sprintf("%c", os.PathSeparator)
|
COMPOSER_DEP_DIR = "vendor"
|
||||||
|
PathSeparator = fmt.Sprintf("%c", os.PathSeparator)
|
||||||
)
|
)
|
||||||
|
|
||||||
func CacheDir() string {
|
func CacheDir() string {
|
||||||
|
|||||||
Reference in New Issue
Block a user