Skip to content

Checker fails - AttributeError: 'NoneType' object has no attribute 'group' #1300

@anthonyharrison

Description

@anthonyharrison

Checker fails during directory scan

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /usr/lib/python3.9/runpy.py:197 in _run_module_as_main │
│ │
│ 194 │ main_globals = sys.modules["main"].dict
│ 195 │ if alter_argv: │
│ 196 │ │ sys.argv[0] = mod_spec.origin │
│ ❱ 197 │ return _run_code(code, main_globals, None, │
│ 198 │ │ │ │ │ "main", mod_spec) │
│ 199 │
│ 200 def run_module(mod_name, init_globals=None, │
│ │
│ /usr/lib/python3.9/runpy.py:87 in _run_code │
│ │
│ 84 │ │ │ │ │ loader = loader, │
│ 85 │ │ │ │ │ package = pkg_name, │
│ 86 │ │ │ │ │ spec = mod_spec) │
│ ❱ 87 │ exec(code, run_globals) │
│ 88 │ return run_globals │
│ 89 │
│ 90 def _run_module_code(code, init_globals=None, │
│ │
│ /root/Documents/git_repo/cve_latest/lib/python3.9/site-packages/cve_bin_tool/cli.py:468 in │
│ │
│ │
│ 465 │ if os.getenv("NO_EXIT_CVE_NUM"): │
│ 466 │ │ main() │
│ 467 │ else: │
│ ❱ 468 │ │ sys.exit(main()) │
│ 469 │
│ │
│ /root/Documents/git_repo/cve_latest/lib/python3.9/site-packages/cve_bin_tool/cli.py:407 in main │
│ │
│ 404 │ │ │ ) │
│ 405 │ │ │ version_scanner.remove_skiplist(skips) │
│ 406 │ │ │ version_scanner.print_checkers() │
│ ❱ 407 │ │ │ for scan_info in version_scanner.recursive_scan(args["directory"]): │
│ 408 │ │ │ │ if scan_info: │
│ 409 │ │ │ │ │ product_info, path = scan_info │
│ 410 │ │ │ │ │ LOGGER.debug(f"{product_info}: {path}") │
│ │
│ /root/Documents/git_repo/cve_latest/lib/python3.9/site-packages/cve_bin_tool/version_scanner.py: │
│ 258 in recursive_scan │
│ │
│ 255 │ │ │ if os.path.isdir(scan_path): │
│ 256 │ │ │ │ for filepath in self.walker([scan_path]): │
│ 257 │ │ │ │ │ self.file_stack.append(filepath) │
│ ❱ 258 │ │ │ │ │ yield from self.scan_and_or_extract_file(ectx, filepath) │
│ 259 │ │ │ │ │ self.file_stack.pop() │
│ 260 │ │ │ elif os.path.isfile(scan_path): │
│ 261 │ │ │ │ self.file_stack.append(scan_path) │
│ │
│ /root/Documents/git_repo/cve_latest/lib/python3.9/site-packages/cve_bin_tool/version_scanner.py: │
│ 250 in scan_and_or_extract_file │
│ │
│ 247 │ │ │ for filename in self.walker([ectx.extract(filepath)]): │
│ 248 │ │ │ │ clean_path = self.clean_file_path(filename) │
│ 249 │ │ │ │ self.file_stack.append(f" contains {clean_path}") │
│ ❱ 250 │ │ │ │ yield from self.scan_and_or_extract_file(ectx, filename) │
│ 251 │ │ │ │ self.file_stack.pop() │
│ 252 │ │
│ 253 │ def recursive_scan(self, scan_path): │
│ │
│ /root/Documents/git_repo/cve_latest/lib/python3.9/site-packages/cve_bin_tool/version_scanner.py: │
│ 239 in scan_and_or_extract_file │
│ │
│ 236 │ def scan_and_or_extract_file(self, ectx, filepath): │
│ 237 │ │ """Runs extraction if possible and desired otherwise scans.""" │
│ 238 │ │ # Scan the file │
│ ❱ 239 │ │ yield from self.scan_file(filepath) │
│ 240 │ │ # Attempt to extract the file and scan the contents │
│ 241 │ │ if ectx.can_extract(filepath): │
│ 242 │ │ │ if not self.should_extract: │
│ │
│ /root/Documents/git_repo/cve_latest/lib/python3.9/site-packages/cve_bin_tool/version_scanner.py: │
│ 162 in scan_file │
│ │
│ 159 │ │ # If python package then strip the lines to avoid detecting other product strin │
│ 160 │ │ if "PKG-INFO: " in output or "METADATA: " in output: │
│ 161 │ │ │ py_lines = "\n".join(lines.splitlines()[:3]) │
│ ❱ 162 │ │ │ yield from self.run_python_package_checkers(filename, py_lines) │
│ 163 │ │ │
│ 164 │ │ yield from self.run_checkers(filename, lines) │
│ 165 │
│ │
│ /root/Documents/git_repo/cve_latest/lib/python3.9/site-packages/cve_bin_tool/version_scanner.py: │
│ 172 in run_python_package_checkers │
│ │
│ 169 │ │ There are no actual checkers. │
│ 170 │ │ The ProductInfo is computed without the help of any checkers from PKG-INFO or ME │
│ 171 │ │ """ │
│ ❱ 172 │ │ product = search(compile(r"^Name: (.+)$", MULTILINE), lines).group(1) │
│ 173 │ │ version = search(compile(r"^Version: (.+)$", MULTILINE), lines).group(1) │
│ 174 │ │ │
│ 175 │ │ with VendorFetch() as vendor_fetch: │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'NoneType' object has no attribute 'group'

File being processed was METADATA file within dateutil-zoneinfo.tar.gz within dateutil Python site-packages.

METADATA contents

{
    "metadata_version": 2.0,
    "releases_url": [
        "https://dateutil.github.io/tzdata/tzdata/",
        "ftp://ftp.iana.org/tz/releases/"
    ],
    "tzdata_file": "tzdata2017b.tar.gz",
    "tzdata_file_sha512": "3e090dba1f52e4c63b4930b28f4bf38b56aabd6728f23094cb5801d10f4e464f17231f17b75b88
66714bf98199c166ea840de0787b75b2274aa419a4e14bbc4d",
    "tzversion": "2017b",
    "zonegroups": [
        "africa",
        "antarctica",
        "asia",
        "australasia",
        "europe",
        "northamerica",
        "southamerica",
        "pacificnew",
        "etcetera",
        "systemv",
        "factory",
        "backzone",
        "backward"
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions