From cbf70e105f0236dadcb03cf799b2fac7883237b3 Mon Sep 17 00:00:00 2001 From: MaineK00n Date: Thu, 30 Jul 2020 05:10:53 +0900 Subject: [PATCH] add take note of TODO --- scan/debian.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scan/debian.go b/scan/debian.go index 9b2903f6..52b13081 100644 --- a/scan/debian.go +++ b/scan/debian.go @@ -317,7 +317,6 @@ func (o *debian) scanPackages() error { if o.Distro.Family == config.Raspbian { raspbianPacks := o.grepRaspbianPackages(updatable) - //TODO: raspbianPacksのpackageのchangelogを取得する unsecures, err := o.scanUnsecurePackages(raspbianPacks) if err != nil { o.log.Errorf("Failed to scan vulnerable packages: %s", err) @@ -773,6 +772,7 @@ func (o *debian) fetchParseChangelog(pack models.Package) ([]DetectedCveID, *mod packChangelogDir := "" if o.Distro.Family == config.Raspbian { + // TODO: Don't make it every time (only once at the beginning) cmd = fmt.Sprintf(`mkdir -p /tmp/vuls`) cmd = util.PrependProxyEnv(cmd) r := o.exec(cmd, noSudo) @@ -789,6 +789,7 @@ func (o *debian) fetchParseChangelog(pack models.Package) ([]DetectedCveID, *mod return nil, nil, nil } + // TODO: Consider the possibility that tmp_armhf.deb and tmp_arm64.deb exist when searching with find // e.g. 7:4.1.6-1~deb10u1+rpt1b\n => 7%3a4.1.6-1~deb10u1+rpt1 debPackNewVersion := strings.Replace(pack.NewVersion, ":", "%3a", -1) cmd = fmt.Sprintf(`find /tmp/vuls -name "%s_%s*.deb"`, pack.Name, debPackNewVersion) @@ -801,7 +802,6 @@ func (o *debian) fetchParseChangelog(pack models.Package) ([]DetectedCveID, *mod // e.g. /tmp/vuls/ffmpeg_7%3a4.1.6-1~deb10u1+rpt1_armhf.deb\n => /tmp/vuls/ffmpeg_7%3a4.1.6-1~deb10u1+rpt1_armhf packChangelogDir = strings.TrimRight(r.Stdout, ".deb\n") - o.log.Debugf(`packChangelogDir:%s`, packChangelogDir) cmd = fmt.Sprintf(`dpkg-deb -x %s.deb %s`, packChangelogDir, packChangelogDir) cmd = util.PrependProxyEnv(cmd) r = o.exec(cmd, noSudo)