Skip to content
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

[BUG]: Packages can be missing the version field #171

Closed
1 task done
andrewjw opened this issue Apr 13, 2023 · 0 comments
Closed
1 task done

[BUG]: Packages can be missing the version field #171

andrewjw opened this issue Apr 13, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@andrewjw
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

When trying the load the vulnerabilities for a project I get the exception pasted below, which I believe is occuring because the Package object requires a version field, but the Snyk API is not returning one.

Traceback (most recent call last):
  File "<string>", line 15, in from_dict
  File "<string>", line 15, in <listcomp>
  File "<string>", line 15, in <listcomp>
  File "<string>", line 18, in from_dict
mashumaro.exceptions.MissingField: Field "version" of type str is missing in Package instance

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "...bin/snyk_deps.py", line 93, in <module>
    main(sys.argv[1] == "--dry-run" if len(sys.argv) > 1 else False)
  File "...bin/snyk_deps.py", line 59, in main
    vulns = {(v.package, None if hasattr(v, "version") else None): float(v.cvssScore) if v.cvssScore is not None else None for v in snyk_proj.vulnerabilities}
  File "../homebrew/lib/python3.10/site-packages/snyk/models.py", line 641, in vulnerabilities
    foo = flat_map(self._aggregated_issue_to_vulnerabily, aggregated_vulns)
  File ".../homebrew/lib/python3.10/site-packages/snyk/utils.py", line 18, in flat_map
    return list(chain(*mapped))
  File ".../homebrew/lib/python3.10/site-packages/snyk/models.py", line 662, in _aggregated_issue_to_vulnerabily
    ).all()
  File ".../homebrew/lib/python3.10/site-packages/snyk/managers.py", line 450, in all
    return self.klass.from_dict(resp.json())
  File "<string>", line 22, in from_dict
mashumaro.exceptions.InvalidFieldValue: Field "paths" of type List[List[Package]] in IssuePaths has invalid value [[{'name': 'root'}, {'name': 'net.logstash.logback:logstash-logback-encoder', 'version': '4.11'}, {'name': 'com.fasterxml.jackson.core:jackson-databind', 'version': '2.8.9'}]]

Steps To Reproduce

I'm not sure how to reproduce this, I presume need a Snyk project with a particular set of dependencies.

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant