<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13139</bug_id>
          
          <creation_ts>2019-01-14 11:57:57 +0000</creation_ts>
          <short_desc>Triage fails</short_desc>
          <delta_ts>2019-01-22 21:11:56 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Security Response Tool</product>
          <component>General</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.7 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Burton">ross.burton</reporter>
          <assigned_to name="David Reyna">david.reyna</assigned_to>
          
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>82775</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-01-14 11:57:57 +0000</bug_when>
    <thetext>Go to triage, select some bugs and press Not Vulnerable.

error on request:
invalid literal for int() with base 10: &apos;&apos;
Traceback (most recent call last):
  File &quot;/home/ross/Yocto/srtool/lib/srtgui/views.py&quot;, line 1061, in xhr_triage_commit
    cve.save()
  File &quot;/home/ross/Yocto/srtool/lib/orm/models.py&quot;, line 64, in save
    return _base_save(self, *args, **kwargs)
  File &quot;/home/ross/.local/lib/python3.5/site-packages/django/db/models/base.py&quot;, line 718, in save
    force_update=force_update, update_fields=update_fields)
  File &quot;/home/ross/.local/lib/python3.5/site-packages/django/db/models/base.py&quot;, line 748, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File &quot;/home/ross/.local/lib/python3.5/site-packages/django/db/models/base.py&quot;, line 812, in _save_table
    forced_update)
  File &quot;/home/ross/.local/lib/python3.5/site-packages/django/db/models/base.py&quot;, line 861, in _do_update
    return filtered._update(values) &gt; 0
  File &quot;/home/ross/.local/lib/python3.5/site-packages/django/db/models/query.py&quot;, line 712, in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
  File &quot;/home/ross/.local/lib/python3.5/site-packages/django/db/models/sql/compiler.py&quot;, line 1383, in execute_sql
    cursor = super().execute_sql(result_type)
  File &quot;/home/ross/.local/lib/python3.5/site-packages/django/db/models/sql/compiler.py&quot;, line 1052, in execute_sql
    sql, params = self.as_sql()
  File &quot;/home/ross/.local/lib/python3.5/site-packages/django/db/models/sql/compiler.py&quot;, line 1349, in as_sql
    val = field.get_db_prep_save(val, connection=self.connection)
  File &quot;/home/ross/.local/lib/python3.5/site-packages/django/db/models/fields/__init__.py&quot;, line 790, in get_db_prep_save
    return self.get_db_prep_value(value, connection=connection, prepared=False)
  File &quot;/home/ross/.local/lib/python3.5/site-packages/django/db/models/fields/__init__.py&quot;, line 785, in get_db_prep_value
    value = self.get_prep_value(value)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82778</commentid>
    <comment_count>1</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2019-01-14 12:08:05 +0000</bug_when>
    <thetext>Hmm, this is not failing for me unfortunately.

1. In my source it is line 1064 that is the &quot;cve.save()&quot;, not line 1061 as reported in the traceback. That is odd.

2. If you could add a &quot;_log(&quot;FOO:CVE=%s&quot; % cve)&quot; before the &quot;cve.save()&quot;, run the code, and then run &quot;./tail()&quot;, we could perhaps see what value in the CVE record is off.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82779</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-01-14 12:50:06 +0000</bug_when>
    <thetext>The line number difference is probably because I have a few changes locally.

However I now can&apos;t replicate.  If I break it again, I&apos;ll reopen with logs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82780</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-01-14 12:52:16 +0000</bug_when>
    <thetext>Okay did it again.  Will get more info</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82781</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-01-14 12:56:08 +0000</bug_when>
    <thetext>|TRIAGING:CVE=&lt;Cve: Cve object (66202)&gt;|

Need a better way to dump the contents than str() or repr().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82783</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-01-14 13:18:59 +0000</bug_when>
    <thetext>It&apos;s just CVE-2019-6137</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82784</commentid>
    <comment_count>6</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-01-14 13:25:43 +0000</bug_when>
    <thetext>Ah.

From a manage shell:

&gt;&gt;&gt; c = orm.models.Cve.objects.get(name=&apos;CVE-2019-6137&apos;)
&gt;&gt;&gt; c.recommend
&apos;&apos;

That&apos;s an integer field.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82785</commentid>
    <comment_count>7</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-01-14 14:07:48 +0000</bug_when>
    <thetext>c.recommend = 0; c.save() fixed it.  Iterating through the entire database shows this has happened more than once for some reason.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82786</commentid>
    <comment_count>8</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-01-14 14:14:13 +0000</bug_when>
    <thetext>More than one == lots.

&gt;&gt;&gt; counter = 0
&gt;&gt;&gt; broken = 0
&gt;&gt;&gt; for c in orm.models.Cve.objects.iterator():
...   counter+=1
...   if not isinstance(c.recommend, type(1)):
...     broken+=1
...
&gt;&gt;&gt; counter
66334
&gt;&gt;&gt; broken
20168</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82789</commentid>
    <comment_count>9</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2019-01-14 19:28:08 +0000</bug_when>
    <thetext>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 &apos;score_date&apos; field to better track the scoring. I just have to fix the creation default value (to 0) and this is done.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82792</commentid>
    <comment_count>10</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2019-01-14 23:45:44 +0000</bug_when>
    <thetext>commit 959cc8196aab2231b7f6f05c7e0151f8de46ea48

The error was in the &quot;srtool_mitre.py&quot; script that was creating &apos;reserved&apos; 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</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>