Skip to content

feat(checker): add fish checker #5167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cve_bin_tool/checkers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"file",
"firefox",
"firejail",
"fish",
"flac",
"fluidsynth",
"freeradius",
Expand Down
20 changes: 20 additions & 0 deletions cve_bin_tool/checkers/fish.py

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex "fish-([0-9]+.[0-9]+.[0-9]+)" doesn't catch the packages fish_3.1.2-3+deb11u1_amd64.deb or fish_3.1.0-1_x86_64.ipk because they have a "" after the string "fish" and your regex only matches if a "-" follows "fish". I tried this regex "fish-|([0-9]+.[0-9]+.[0-9]+)" and it seems to catch all 4 packages.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (C) 2025 Orange
# SPDX-License-Identifier: GPL-3.0-or-later


"""
CVE checker for fish
https://www.cvedetails.com/product/43564/Fishshell-Fish.html?vendor_id=17623
"""
from __future__ import annotations

from cve_bin_tool.checkers import Checker


class FishChecker(Checker):
CONTAINS_PATTERNS: list[str] = []
FILENAME_PATTERNS: list[str] = []
VERSION_PATTERNS = [r"fish-([0-9]+\.[0-9]+\.[0-9]+)"]
VENDOR_PRODUCT = [("fishshell", "fish")]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
34 changes: 34 additions & 0 deletions test/test_data/fish.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (C) 2025 Orange
# SPDX-License-Identifier: GPL-3.0-or-later

mapping_test_data = [
{"product": "fish", "version": "3.1.0", "version_strings": ["fish-3.1.0"]}
]
package_test_data = [
{
"url": "http://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/aarch64/os/Packages/f/",
"package_name": "fish-4.0.2-1.fc43.aarch64.rpm",
"product": "fish",
"version": "4.0.2",
"other_products": ["rust"],
},
{
"url": "http://ftp.debian.org/debian/pool/main/f/fish/",
"package_name": "fish_3.1.2-3+deb11u1_amd64.deb",
"product": "fish",
"version": "3.1.2",
},
{
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
"package_name": "fish_3.1.0-1_x86_64.ipk",
"product": "fish",
"version": "3.1.0",
},
{
"url": "https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/",
"package_name": "fish-3.1.2-r4.apk",
"product": "fish",
"version": "3.1.2",
"other_products": ["gcc"],
},
]
Loading