Skip to content

Search for vulnerability throws error "could not convert string to float: 'Important'" #1302

Description

@johnmhoran

While exploring various vulnerability DBs to see how affecting and fixed by vulnerabilities are described, I searched VCIO for pkg:maven/org.apache.tomcat.embed/tomcat-embed-core@7.0.104, clicked the link at the bottom of the Package details page for the fixed by vulnerability VCID-nm9b-h95h-aaaa (the table's current heading is still Fixing vulnerabilities), and was taken to https://public.vulnerablecode.io/vulnerabilities/VCID-nm9b-h95h-aaaa, which displays Server Error (500).

I understand that this error might have been introduced in this PR: #1179 .

On my laptop, following these steps on the local DB instance displays the following information in the WSL2 terminal:

[18/Sep/2023 16:57:13] "GET /favicon.ico HTTP/1.1" 404 3476
Internal Server Error: /vulnerabilities/VCID-nm9b-h95h-aaaa
Traceback (most recent call last):
  File "/home/jmh/dev/nexb/vulnerablecode/vulnerabilities/utils.py", line 528, in get_severity_range
    score_list.append(float(score))
ValueError: could not convert string to float: 'Important'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jmh/dev/nexb/vulnerablecode/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 56, in inner
    response = get_response(request)
  File "/home/jmh/dev/nexb/vulnerablecode/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/home/jmh/dev/nexb/vulnerablecode/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 103, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/jmh/dev/nexb/vulnerablecode/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 142, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/jmh/dev/nexb/vulnerablecode/venv/lib/python3.8/site-packages/django/views/generic/detail.py", line 109, in get
    context = self.get_context_data(object=self.object)
  File "/home/jmh/dev/nexb/vulnerablecode/vulnerabilities/views.py", line 131, in get_context_data
    "severity_score_range": get_severity_range(
  File "/home/jmh/dev/nexb/vulnerablecode/vulnerabilities/utils.py", line 530, in get_severity_range
    score_list.extend(score_map[score.lower()])
KeyError: 'important'
[18/Sep/2023 17:02:02] "GET /vulnerabilities/VCID-nm9b-h95h-aaaa HTTP/1.1" 500 98764

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions