sonatype-nexus-community / jake

Check your Python environments for vulnerable Open Source packages with OSS Index or Sonatype Nexus Lifecycle.
https://jake.readthedocs.io/
Apache License 2.0
111 stars 24 forks source link

[BUG] KeyError: 'displayName' #119

Open DmytroLitvinov opened 2 years ago

DmytroLitvinov commented 2 years ago

Additional context

$ jake ddt --clear-cache
                   ___           ___           ___     
       ___        /  /\         /  /\         /  /\    
      /__/\      /  /::\       /  /:/        /  /::\   
      \__\:\    /  /:/\:\     /  /:/        /  /:/\:\  
  ___ /  /::\  /  /::\ \:\   /  /::\____   /  /::\ \:\ 
 /__/\  /:/\/ /__/:/\:\_\:\ /__/:/\:::::\ /__/:/\:\ \:\
 \  \:\/:/~~  \__\/  \:\/:/ \__\/~|:|~~~~ \  \:\ \:\_\/
  \  \::/          \__\::/     |  |:|      \  \:\ \:\  
   \__\/           /  /:/      |  |:|       \  \:\_\/  
                  /__/:/       |__|:|        \  \:\    
                  \__\/         \__\|         \__\/    

            /)                     /)             
        _/_(/    _     _  __   _  (/_   _         
 o   o  (__/ )__(/_   /_)_/ (_(_(_/(___(/_ o   o  

Jake Version: 1.4.5
Put your Python dependencies in a chokehold
🐍 Collected 262 packages from your environment ━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Querying OSS Index for details on your packages ━━━━━╸               30% 0:00:01
Sanity checking...                                                    0% -:--:--
Traceback (most recent call last):
  File "/builds/g4506/gryps/gryps_ch/venv/bin/jake", line 8, in <module>
    sys.exit(main())
  File "/builds/g4506/gryps/gryps_ch/venv/lib/python3.8/site-packages/jake/app.py", line 124, in main
    JakeCmd().execute()
  File "/builds/g4506/gryps/gryps_ch/venv/lib/python3.8/site-packages/jake/app.py", line 69, in execute
    exit_code: int = command.execute(arguments=self._arguments)
  File "/builds/g4506/gryps/gryps_ch/venv/lib/python3.8/site-packages/jake/command/__init__.py", line 45, in execute
    return self.handle_args()
  File "/builds/g4506/gryps/gryps_ch/venv/lib/python3.8/site-packages/jake/command/oss.py", line 78, in handle_args
    oss_index_results = oss.get_component_report(
  File "/builds/g4506/gryps/gryps_ch/venv/lib/python3.8/site-packages/ossindex/ossindex.py", line 59, in get_component_report
    return self._get_results(packages=packages)
  File "/builds/g4506/gryps/gryps_ch/venv/lib/python3.8/site-packages/ossindex/ossindex.py", line 146, in _get_results
    results = results + self._make_oss_index_component_report_call(packages=chunk)
  File "/builds/g4506/gryps/gryps_ch/venv/lib/python3.8/site-packages/ossindex/ossindex.py", line 161, in _make_oss_index_component_report_call
    results = json.loads(response.text, cls=_OssIndexResponseDecoder)
  File "/usr/local/lib/python3.8/json/__init__.py", line 370, in loads
    return cls(**kw).decode(s)
  File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.8/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
  File "/builds/g4506/gryps/gryps_ch/venv/lib/python3.8/site-packages/ossindex/ossindex.py", line 32, in _to_model
    return Vulnerability.from_json(o)
  File "/builds/g4506/gryps/gryps_ch/venv/lib/python3.8/site-packages/ossindex/model.py", line 48, in from_json
    display_name=o['displayName'],
KeyError: 'displayName'
bhamail commented 2 years ago

@DmytroLitvinov I think the discussion here will help: https://github.com/sonatype-nexus-community/jake/issues/118 If the issue persists, please comment here.

madpah commented 2 years ago

@DmytroLitvinov - given OSS Index has introduced breaking changes (see #121) - can you look to see if:

  1. You are still seeing this issue (we are aware an OSS Index issue was resolved last week)
  2. If you are with jake 1.4.5, can you look at using the latest jake to confirm?
DmytroLitvinov commented 2 years ago

Hi @madpah , Yes, it works.

The only left issue related to ecosystem packages is that one of package strict requires PyYAML<6. Here is a related issue https://github.com/sonatype-nexus-community/ossindex-python/issues/8. My proposal is still actual for now :)