Go to triage, select some bugs and press Not Vulnerable. error on request: invalid literal for int() with base 10: '' Traceback (most recent call last): File "/home/ross/Yocto/srtool/lib/srtgui/views.py", line 1061, in xhr_triage_commit cve.save() File "/home/ross/Yocto/srtool/lib/orm/models.py", line 64, in save return _base_save(self, *args, **kwargs) File "/home/ross/.local/lib/python3.5/site-packages/django/db/models/base.py", line 718, in save force_update=force_update, update_fields=update_fields) File "/home/ross/.local/lib/python3.5/site-packages/django/db/models/base.py", line 748, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/home/ross/.local/lib/python3.5/site-packages/django/db/models/base.py", line 812, in _save_table forced_update) File "/home/ross/.local/lib/python3.5/site-packages/django/db/models/base.py", line 861, in _do_update return filtered._update(values) > 0 File "/home/ross/.local/lib/python3.5/site-packages/django/db/models/query.py", line 712, in _update return query.get_compiler(self.db).execute_sql(CURSOR) File "/home/ross/.local/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 1383, in execute_sql cursor = super().execute_sql(result_type) File "/home/ross/.local/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 1052, in execute_sql sql, params = self.as_sql() File "/home/ross/.local/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 1349, in as_sql val = field.get_db_prep_save(val, connection=self.connection) File "/home/ross/.local/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 790, in get_db_prep_save return self.get_db_prep_value(value, connection=connection, prepared=False) File "/home/ross/.local/lib/python3.5/site-packages/django/db/models/fields/__init__.py", line 785, in get_db_prep_value value = self.get_prep_value(value)
Hmm, this is not failing for me unfortunately. 1. In my source it is line 1064 that is the "cve.save()", not line 1061 as reported in the traceback. That is odd. 2. If you could add a "_log("FOO:CVE=%s" % cve)" before the "cve.save()", run the code, and then run "./tail()", we could perhaps see what value in the CVE record is off.
The line number difference is probably because I have a few changes locally. However I now can't replicate. If I break it again, I'll reopen with logs.
Okay did it again. Will get more info
|TRIAGING:CVE=<Cve: Cve object (66202)>| Need a better way to dump the contents than str() or repr().
It's just CVE-2019-6137
Ah. From a manage shell: >>> c = orm.models.Cve.objects.get(name='CVE-2019-6137') >>> c.recommend '' That's an integer field.
c.recommend = 0; c.save() fixed it. Iterating through the entire database shows this has happened more than once for some reason.
More than one == lots. >>> counter = 0 >>> broken = 0 >>> for c in orm.models.Cve.objects.iterator(): ... counter+=1 ... if not isinstance(c.recommend, type(1)): ... broken+=1 ... >>> counter 66334 >>> broken 20168
Ah, it will be fixed today. These problem records are ones that have not been scored yet. I had the idea of leaving these field empty to indicate that had not been scored (the processing which I moved to a second asynchronous data source because of the time overhead). The problem is that this is an invalid integer which fails if you try to triage, as you observed. I had not hit this problem because (a) I was always manually executing the scoring routine, and (b) the new auto-updater code I am finishing resolves the scoring. I had already created the 'score_date' field to better track the scoring. I just have to fix the creation default value (to 0) and this is done.
commit 959cc8196aab2231b7f6f05c7e0151f8de46ea48 The error was in the "srtool_mitre.py" script that was creating 'reserved' CVEs. I have added a database fix routine (./bin/common/srtool_common.py --fix-cve-recommend) and attached it to the SRTool startup (via ./bin/common/srtool_common.py --generate-schema-header) so that existing databases can be automatically repaired: $ ./stop.sh $ git pull $ ./start.sh