Skip to content

Commit

Permalink
feat(checker): add go checker
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrice Fontaine <[email protected]>
  • Loading branch information
ffontaine committed Dec 20, 2023
1 parent eece00a commit 9a8b5a6
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions cve_bin_tool/checkers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"gnutls",
"glib",
"glibc",
"go",
"gpgme",
"gpsd",
"graphicsmagick",
Expand Down
20 changes: 20 additions & 0 deletions cve_bin_tool/checkers/go.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (C) 2023 Orange
# SPDX-License-Identifier: GPL-3.0-or-later


"""
CVE checker for go
https://www.cvedetails.com/product/29205/Golang-GO.html?vendor_id=14185
"""
from __future__ import annotations

from cve_bin_tool.checkers import Checker


class GoChecker(Checker):
CONTAINS_PATTERNS: list[str] = []
FILENAME_PATTERNS: list[str] = []
VERSION_PATTERNS = [r"go([0-9]+\.[0-9]+\.[0-9]+)"]
VENDOR_PRODUCT = [("golang", "go")]
Binary file added test/condensed-downloads/go-1.13.13-r0.apk.tar.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
26 changes: 26 additions & 0 deletions test/test_data/go.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (C) 2023 Orange
# SPDX-License-Identifier: GPL-3.0-or-later

mapping_test_data = [
{"product": "go", "version": "1.11.6", "version_strings": ["go1.11.6"]}
]
package_test_data = [
{
"url": "http://ftp.fr.debian.org/debian/pool/main/g/golang-1.11/",
"package_name": "golang-1.11-go_1.11.6-1+deb10u4_amd64.deb",
"product": "go",
"version": "1.11.6",
},
{
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
"package_name": "golang_1.13.15-1_x86_64.ipk",
"product": "go",
"version": "1.13.15",
},
{
"url": "https://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/",
"package_name": "go-1.13.13-r0.apk",
"product": "go",
"version": "1.13.13",
},
]

0 comments on commit 9a8b5a6

Please sign in to comment.