Skip to content

Commit ceb4e47

Browse files
authored
fix(apk): replace go-deb-version with go-apk-version (fanal#118)
* fix(apk): replace go-deb-version with go-apk-version * chore(mod): update dependencies * chore(mod): update go-apk-version
1 parent 4025117 commit ceb4e47

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

analyzer/pkg/apk/apk.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"log"
77
"os"
88

9-
debVersion "github.com/knqyf263/go-deb-version"
9+
apkVersion "github.com/knqyf263/go-apk-version"
1010

1111
"github.com/aquasecurity/fanal/analyzer"
1212
fos "github.com/aquasecurity/fanal/analyzer/os"
@@ -49,7 +49,7 @@ func (a alpinePkgAnalyzer) parseApkInfo(scanner *bufio.Scanner) (pkgs []types.Pa
4949
pkg.Name = line[2:]
5050
case "V:":
5151
version = string(line[2:])
52-
if !debVersion.Valid(version) {
52+
if !apkVersion.Valid(version) {
5353
log.Printf("Invalid Version Found : OS %s, Package %s, Version %s", "alpine", pkg.Name, version)
5454
continue
5555
}

analyzer/pkg/apk/apk_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestParseApkInfo(t *testing.T) {
3535
{Name: "pkgconf", Version: "1.6.0-r0"},
3636
{Name: "sqlite", Version: "3.26.0-r3"},
3737
{Name: "sqlite-libs", Version: "3.26.0-r3"},
38-
{Name: "sqlite-dev", Version: "3.26.0-r3"},
38+
{Name: "test", Version: "2.9.11_pre20061021-r2"},
3939
},
4040
},
4141
}

analyzer/pkg/apk/testdata/apk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,8 +511,8 @@ a:0:0:755
511511
Z:Q1BOGonxBB2SdxbKENvJNl9ifknaE=
512512

513513
C:Q18L8xXsVIKBiJEOSmZcALxIvb3X0=
514-
P:sqlite-dev
515-
V:3.26.0-r3
514+
P:test
515+
V:2.9.11_pre20061021-r2
516516
A:x86_64
517517
S:151185
518518
I:618496

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ require (
1515
github.com/go-git/go-git/v5 v5.0.0
1616
github.com/google/go-containerregistry v0.0.0-20200331213917-3d03ed9b1ca2
1717
github.com/hashicorp/go-multierror v1.1.0
18+
github.com/knqyf263/go-apk-version v0.0.0-20200609155635-041fdbb8563f
1819
github.com/knqyf263/go-deb-version v0.0.0-20190517075300-09fca494f03d
1920
github.com/knqyf263/go-rpmdb v0.0.0-20190501070121-10a1c42a10dc
2021
github.com/knqyf263/nested v0.0.1
@@ -23,7 +24,7 @@ require (
2324
github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6 // indirect
2425
github.com/saracen/walker v0.0.0-20191201085201-324a081bae7e
2526
github.com/sosedoff/gitkit v0.2.0
26-
github.com/stretchr/testify v1.4.0
27+
github.com/stretchr/testify v1.5.1
2728
github.com/testcontainers/testcontainers-go v0.3.1
2829
github.com/urfave/cli/v2 v2.2.0
2930
go.etcd.io/bbolt v1.3.3

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQL
240240
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
241241
github.com/knqyf263/berkeleydb v0.0.0-20190501065933-fafe01fb9662 h1:UGS0RbPHwXJkq8tcba8OD0nvVUWLf2h7uUJznuHPPB0=
242242
github.com/knqyf263/berkeleydb v0.0.0-20190501065933-fafe01fb9662/go.mod h1:bu1CcN4tUtoRcI/B/RFHhxMNKFHVq/c3SV+UTyduoXg=
243+
github.com/knqyf263/go-apk-version v0.0.0-20200609155635-041fdbb8563f h1:GvCU5GXhHq+7LeOzx/haG7HSIZokl3/0GkoUFzsRJjg=
244+
github.com/knqyf263/go-apk-version v0.0.0-20200609155635-041fdbb8563f/go.mod h1:q59u9px8b7UTj0nIjEjvmTWekazka6xIt6Uogz5Dm+8=
243245
github.com/knqyf263/go-deb-version v0.0.0-20190517075300-09fca494f03d h1:X4cedH4Kn3JPupAwwWuo4AzYp16P0OyLO9d7OnMZc/c=
244246
github.com/knqyf263/go-deb-version v0.0.0-20190517075300-09fca494f03d/go.mod h1:o8sgWoz3JADecfc/cTYD92/Et1yMqMy0utV1z+VaZao=
245247
github.com/knqyf263/go-rpmdb v0.0.0-20190501070121-10a1c42a10dc h1:pumO9pqmRAjvic6oove22RGh9wDZQnj96XQjJSbSEPs=
@@ -370,6 +372,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
370372
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
371373
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
372374
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
375+
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
376+
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
373377
github.com/testcontainers/testcontainers-go v0.3.1 h1:KZkEKNfnlsipJblzGCz6fmzd+0DzJ3djulYrislG3Zw=
374378
github.com/testcontainers/testcontainers-go v0.3.1/go.mod h1:br7bkzIukhPSIjy07Ma3OuXjjFvl2jm7CDU0LQNsqLw=
375379
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=

0 commit comments

Comments
 (0)