Skip to content

Key Error in rust scraper when importing data. #154

Description

@EslamHiko

I got this error when I was Importing data
DJANGO_DEV=1 python manage.py import --all

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/islam/Desktop/vulnerablecode/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/home/islam/Desktop/vulnerablecode/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/islam/Desktop/vulnerablecode/venv/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/islam/Desktop/vulnerablecode/venv/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "/home/islam/Desktop/vulnerablecode/vulnerabilities/management/commands/import.py", line 60, in handle
    self.import_data(IMPORTERS.keys())
  File "/home/islam/Desktop/vulnerablecode/vulnerabilities/management/commands/import.py", line 84, in import_data
    IMPORTERS[src]()
  File "/home/islam/Desktop/vulnerablecode/vulnerabilities/management/commands/import.py", line 30, in <lambda>
    'rust': lambda: dd.rust_dump(rust.import_vulnerabilities()),
  File "/home/islam/Desktop/vulnerablecode/vulnerabilities/scraper/rust.py", line 41, in import_vulnerabilities
    patched_version_range_list = advisory['advisory']['patched_versions']
KeyError: 'patched_versions'

I inspected advisory['advisory'] and the result didn't have patched_versions key

{
'id': 'RUSTSEC-2019-0001',
 'package': 'ammonia',
 'date': '2019-04-27',
 'title': 'Uncontrolled recursion leads to abort in HTML serialization',
 'url': 'https://github.com/rust-ammonia/ammonia/blob/master/CHANGELOG.md#210',
 'keywords': ['stack-overflow', 'crash'],
 'description': 'Affected versions of this crate did use recursion for serialization of HTML\nDOM trees.\n\nThis allows an attacker to cause abort due to stack overflow by providing\na pathologically nested input.\n\nThe flaw was corrected by serializing the DOM tree iteratively instead.\n'
}

I've submitted a quick fix for this issue in this PR : #155

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

    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