Skip to content

Commit

Permalink
Input sqlite db should follow lowercase identifier convention (#526)
Browse files Browse the repository at this point in the history
* input db should also follow lowercase ID convention

Fixes a bug where overrides were always missing because of writing on an
uppercase key and reading on a lowercase key.

Signed-off-by: Will Murphy <[email protected]>

* remove unneeded input

Signed-off-by: Will Murphy <[email protected]>

* fix: only log that overrides are disabled if true

Signed-off-by: Will Murphy <[email protected]>

---------

Signed-off-by: Will Murphy <[email protected]>
  • Loading branch information
willmurphyscode authored Mar 28, 2024
1 parent 90b176c commit 31e3c0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/vunnel/providers/nvd/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def get(
yield cve_to_id(cve), self._apply_override(cve, original_record)

self.logger.debug(f"applied overrides for {len(override_remaining_cves)} CVEs")

self.logger.debug("overrides are not enabled, skipping...")
else:
self.logger.debug("overrides are not enabled, skipping...")

def _download_nvd_input(
self,
Expand Down Expand Up @@ -165,7 +165,7 @@ def _unwrap_records(
record_id = cve_to_id(cve_id)

# keep input for future overrides
writer.write(record_id, self.schema, vuln)
writer.write(record_id.lower(), self.schema, vuln)

# apply overrides to output
yield record_id, self._apply_override(cve_id=cve_id, record=vuln)
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/providers/nvd/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ def test_parser(tmpdir, helpers, mock_data_path, mocker):
actual_vulns = list(subject.get(None))

assert expected_vulns == actual_vulns
for vuln in actual_vulns:
assert subject._sqlite_reader().read(vuln[0].lower()) is not None

0 comments on commit 31e3c0a

Please sign in to comment.