Skip to content

Commit a158155

Browse files
authored
fix: improve schema validation for bandit (#4320)
In the course of some other refactoring in cvedb.py, we've got another way to handle schema valiation such that bandit won't complain. * fixes #3933 * closes #3965 --------- Signed-off-by: Terri Oda <[email protected]>
1 parent 83b22b9 commit a158155

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cve_bin_tool/cvedb.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ class CVEDB:
156156
"cve_exploited": "SELECT * FROM cve_exploited WHERE 1=0",
157157
"cve_metrics": "SELECT * FROM cve_metrics WHERE 1=0",
158158
"metrics": "SELECT * FROM metrics WHERE 1=0",
159+
"mismatch": "SELECT * FROM mismatch WHERE 1=0",
160+
"purl2cpe": "SELECT * FROM purl2cpe WHERE 1=0",
159161
}
160162

161163
INSERT_QUERIES = {
@@ -344,7 +346,7 @@ def latest_schema(
344346

345347
self.LOGGER.debug("Check database is using latest schema")
346348
cursor = self.db_open_and_get_cursor()
347-
schema_check = f"SELECT * FROM {table_name} WHERE 1=0" # nosec
349+
schema_check = self.EMPTY_SELECT_QUERIES[table_name]
348350
result = cursor.execute(schema_check)
349351
schema_latest = False
350352

0 commit comments

Comments
 (0)