Skip to content

Commit 8edcc62

Browse files
ankk13knqyf263
andauthored
feat(nodejs): support package.json (#1225)
Co-authored-by: knqyf263 <knqyf263@gmail.com>
1 parent 31c45ff commit 8edcc62

File tree

7 files changed

+17
-7
lines changed

7 files changed

+17
-7
lines changed

docs/vulnerability/detection/language.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
|---------|-------------------------|:---------:|:--------------:|:---------------:|-----------------|
77
| Ruby | Gemfile.lock | - ||| included |
88
| | gemspec ||| - | included |
9-
| Python | Pipfile.lock | - |||excluded |
9+
| Python | Pipfile.lock | - ||| excluded |
1010
| | poetry.lock | - ||| included |
1111
| | requirements.txt | - ||| included |
1212
| | egg package[^1] ||| - | excluded |
1313
| | wheel package[^2] ||| - | excluded |
1414
| PHP | composer.lock |||| excluded |
15-
| Node.js | package-lock.json |||| excluded |
16-
| | yarn.lock |||| ncluded |
15+
| Node.js | package-lock.json | - ||| excluded |
16+
| | yarn.lock | - ||| included |
17+
| | package.json ||| - | excluded |
1718
| .NET | packages.lock.json |||| included |
1819
| Java | JAR/WAR/EAR[^3][^4] |||| included |
1920
| Go | Binaries built by Go[^5] ||| - | excluded |

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/Masterminds/sprig v2.22.0+incompatible
88
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46
99
github.com/aquasecurity/bolt-fixtures v0.0.0-20200903104109-d34e7f983986
10-
github.com/aquasecurity/fanal v0.0.0-20210914172041-6ec4fbcfc2e3
10+
github.com/aquasecurity/fanal v0.0.0-20210915104214-95382456f047
1111
github.com/aquasecurity/go-dep-parser v0.0.0-20210905090655-b95c2c079bbb
1212
github.com/aquasecurity/go-gem-version v0.0.0-20201115065557-8eed6fe000ce
1313
github.com/aquasecurity/go-npm-version v0.0.0-20201110091526-0b796d180798

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6
201201
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
202202
github.com/aquasecurity/bolt-fixtures v0.0.0-20200903104109-d34e7f983986 h1:2a30xLN2sUZcMXl50hg+PJCIDdJgIvIbVcKqLJ/ZrtM=
203203
github.com/aquasecurity/bolt-fixtures v0.0.0-20200903104109-d34e7f983986/go.mod h1:NT+jyeCzXk6vXR5MTkdn4z64TgGfE5HMLC8qfj5unl8=
204-
github.com/aquasecurity/fanal v0.0.0-20210914172041-6ec4fbcfc2e3 h1:ELXkeEQ6d+olRfCig23i3MJWBu/IFLj8StYH8Iqk9aQ=
205-
github.com/aquasecurity/fanal v0.0.0-20210914172041-6ec4fbcfc2e3/go.mod h1:pkPj0NkblwiXdg7Q5RnNlekcJ935StxImiLsU3tCvno=
204+
github.com/aquasecurity/fanal v0.0.0-20210915104214-95382456f047 h1:SmwcaPrdCxxQLlzhVwhZNOs7H4IIICpzEk/3oKwpGts=
205+
github.com/aquasecurity/fanal v0.0.0-20210915104214-95382456f047/go.mod h1:pkPj0NkblwiXdg7Q5RnNlekcJ935StxImiLsU3tCvno=
206206
github.com/aquasecurity/go-dep-parser v0.0.0-20210905090655-b95c2c079bbb h1:RYx2+0fUc/3nR4SywvLAs+Sm3dtLhpBw2IeBE8+w1Po=
207207
github.com/aquasecurity/go-dep-parser v0.0.0-20210905090655-b95c2c079bbb/go.mod h1:Zc7Eo6tFl9l4XcqsWeabD7jHnXRBK/LdgZuu9GTSVLU=
208208
github.com/aquasecurity/go-gem-version v0.0.0-20201115065557-8eed6fe000ce h1:QgBRgJvtEOBtUXilDb1MLi1p1MWoyFDXAu5DEUl5nwM=

pkg/detector/library/driver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func NewDriver(libType string) (Driver, error) {
3131
driver = newCargoDriver()
3232
case ftypes.Composer:
3333
driver = newComposerDriver()
34-
case ftypes.Npm, ftypes.Yarn:
34+
case ftypes.Npm, ftypes.Yarn, ftypes.NodePkg:
3535
driver = newNpmDriver()
3636
case ftypes.Pipenv, ftypes.Poetry, ftypes.Pip, ftypes.PythonPkg:
3737
driver = newPipDriver()

pkg/detector/ospkg/redhat/redhat_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package redhat_test
22

33
import (
4+
"sort"
45
"testing"
56
"time"
67

@@ -205,6 +206,9 @@ func TestScanner_Detect(t *testing.T) {
205206
assert.Contains(t, err.Error(), tt.wantErr)
206207
return
207208
}
209+
sort.Slice(got, func(i, j int) bool {
210+
return got[i].VulnerabilityID < got[j].VulnerabilityID
211+
})
208212
assert.NoError(t, err)
209213
assert.Equal(t, tt.want, got)
210214
})

pkg/detector/ospkg/ubuntu/ubuntu_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package ubuntu_test
22

33
import (
4+
"sort"
45
"testing"
56
"time"
67

@@ -94,6 +95,9 @@ func TestScanner_Detect(t *testing.T) {
9495
assert.Contains(t, err.Error(), tt.wantErr)
9596
return
9697
}
98+
sort.Slice(got, func(i, j int) bool {
99+
return got[i].VulnerabilityID < got[j].VulnerabilityID
100+
})
97101
assert.NoError(t, err)
98102
assert.Equal(t, tt.want, got)
99103
})

pkg/scanner/local/scan.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var (
3030
pkgTargets = map[string]string{
3131
ftypes.PythonPkg: "Python",
3232
ftypes.GemSpec: "Ruby",
33+
ftypes.NodePkg: "Node.js",
3334
}
3435
)
3536

0 commit comments

Comments
 (0)