Skip to content

Commit

Permalink
fix: Avoid broken date from GSD.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Sep 12, 2023
1 parent e487c91 commit eb51a7b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions vulnerabilitylookup/feeders/gsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,19 @@ def gsd_update(self) -> bool:
last_modified = datetime.fromisoformat(vuln['gsd']['osvSchema']['modified'])
if not last_modified and 'namespaces' in vuln:
if 'nvd.nist.gov' in vuln['namespaces']:
last_modified = datetime.fromisoformat(vuln['namespaces']['nvd.nist.gov']['lastModifiedDate'])
try:
last_modified = datetime.fromisoformat(vuln['namespaces']['nvd.nist.gov']['lastModifiedDate'])
except ValueError as e:
# nothing important, just a broken date
self.logger.warning(f'Unable to get modified date: {e}')
needs_lastmodified_from_git = True
elif 'gitlab.com' in vuln['namespaces']:
last_modified = datetime.fromisoformat(vuln['namespaces']['gitlab.com']['advisories'][0]['date'])
try:
last_modified = datetime.fromisoformat(vuln['namespaces']['gitlab.com']['advisories'][0]['date'])
except ValueError as e:
# nothing important, just a broken date
self.logger.warning(f'Unable to get modified date: {e}')
needs_lastmodified_from_git = True
else:
if 'cve.org' in vuln['namespaces'] and vuln['namespaces']['cve.org']['CVE_data_meta']['STATE'] == 'RESERVED':
# reserved ID
Expand Down

0 comments on commit eb51a7b

Please sign in to comment.