From 2b42a7d3066a712464ae7c55ce2fc7921772d20b Mon Sep 17 00:00:00 2001 From: Michael Hohn Date: Thu, 11 Aug 2022 16:56:20 -0700 Subject: [PATCH] scan table change: the results.query_id is the @id from the CodeQL query Before, the query_id was ==> results.csv <== query_id STRING, -- git commit id of the ql query set now, it's query_id STRING, -- @id from the CodeQL query --- notes/tables.org | 2 +- sarif_cli/scan_tables.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/notes/tables.org b/notes/tables.org index 9cdff3c..13cb0aa 100644 --- a/notes/tables.org +++ b/notes/tables.org @@ -299,7 +299,7 @@ ==> results.csv <== id INT, -- primary key scan_id INT, -- scans.id - query_id STRING, -- git commit id of the ql query set + query_id STRING, -- @id from the CodeQL query location STRING, message STRING, message_object OBJ, diff --git a/sarif_cli/scan_tables.py b/sarif_cli/scan_tables.py index 6a924a5..557fa0e 100644 --- a/sarif_cli/scan_tables.py +++ b/sarif_cli/scan_tables.py @@ -172,7 +172,7 @@ def _results_from_kind_problem(basetables, external_info): 'id': [flakegen.next() for _ in range(len(b.kind_problem))], 'scan_id' : e.scan_id, - 'query_id' : e.ql_query_id, + 'query_id' : b.kind_problem.rule_id, 'result_type' : "kind_problem", 'codeFlow_id' : 0, # link to codeflows (kind_pathproblem only, NULL here) @@ -195,6 +195,7 @@ def _results_from_kind_problem(basetables, external_info): 'source_object' : pd.NA, # TODO: find high-level info from query name or tags? 'sink_object' : pd.NA, }) + # Force column type(s) to avoid floats in output. res1 = res.astype({ 'id' : 'uint64', 'scan_id': 'uint64'}).reset_index(drop=True) return res1 @@ -257,7 +258,7 @@ def _results_from_kind_pathproblem(basetables, external_info): # is done, below. res = { 'scan_id' : e.scan_id, - 'query_id' : e.ql_query_id, + 'query_id' : cfid0ppt0.rule_id.values[0], # 'result_type' : "kind_pathproblem", 'codeFlow_id' : cfid0,