@@ -92,7 +92,6 @@ def __str__(self):
9292class CVE (models .Model ):
9393
9494 cve_id = models .CharField (max_length = 255 , unique = True )
95- title = models .CharField (max_length = 255 , blank = True , null = True )
9695 description = models .TextField (blank = True , default = '' )
9796 reserved_date = models .DateTimeField (blank = True , null = True )
9897 published_date = models .DateTimeField (blank = True , null = True )
@@ -233,32 +232,23 @@ def parse_mitre_cve_data(self, cve_json):
233232 if updated_date :
234233 self .updated_date = tz_aware_datetime (cve_metadata .get ('dateUpdated' ))
235234 cna_container = cve_json .get ('containers' ).get ('cna' )
236- title = cna_container .get ('title' )
237- if not title :
238- product = cna_container .get ('product' )
239235 descriptions = cna_container .get ('descriptions' )
240236 if descriptions :
241237 self .description = descriptions [0 ].get ('value' )
242238 problem_types = cna_container .get ('problemTypes' , [])
243239 for problem_type in problem_types :
244240 descriptions = problem_type .get ('descriptions' )
245- if descriptions :
246- for description in descriptions :
247- cwe_description = description .get ('description' )
248- if description .get ('type' ) == 'CWE' :
249- cwe_id = description .get ('cweId' )
250- if cwe_id :
251- cwe , created = CWE .objects .get_or_create (cwe_id = cwe_id )
252- self .cwes .add (cwe )
253- cwe_ids = re .findall (r'CWE-\d+' , cwe_description )
254- for cwe_id in cwe_ids :
241+ for description in descriptions :
242+ if description .get ('type' ) == 'CWE' :
243+ cwe_id = description .get ('cweId' )
244+ if cwe_id :
255245 cwe , created = CWE .objects .get_or_create (cwe_id = cwe_id )
256246 self .cwes .add (cwe )
257- if not title :
258- if product and cwe_description :
259- self . title = f' { product } - { cwe_description } '
260- else :
261- self . title = ''
247+ cwe_description = description . get ( 'description' )
248+ cwe_ids = re . findall ( r'CWE-\d+' , cwe_description )
249+ for cwe_id in cwe_ids :
250+ cwe , created = CWE . objects . get_or_create ( cwe_id = cwe_id )
251+ self . cwes . add ( cwe )
262252 metrics = cna_container .get ('metrics' )
263253 if metrics :
264254 for metric in metrics :
0 commit comments