diff --git a/sarif_cli/scan_tables.py b/sarif_cli/scan_tables.py index 95cea09..852101b 100644 --- a/sarif_cli/scan_tables.py +++ b/sarif_cli/scan_tables.py @@ -82,15 +82,19 @@ def joins_for_projects(basetables, external_info): """ b = basetables; e = external_info - extra = "" + automationDetails = "" # if the sarif does have automationDetails if "automationDetails" in b.project: - extra = b.project.automationDetails[0] + automationDetails = b.project.automationDetails[0] # if the sarif does have versionControlProvenance if "repositoryUri" in b.project: repoUri = b.project.repositoryUri[0] - project_name = b.project.repositoryUri[0] + "-" + extra - e.project_id = hash.hash_unique((repoUri+extra).encode()) + if automationDetails == "no-value-for-ad": + project_name = b.project.repositoryUri[0] + else: + project_name = b.project.repositoryUri[0] + "-" + automationDetails + + e.project_id = hash.hash_unique((repoUri+automationDetails).encode()) else: repoUri = "unknown" @@ -101,7 +105,7 @@ def joins_for_projects(basetables, external_info): "repo_url" : repoUri, "primary_language" : b.project['semmle.sourceLanguage'][0], "languages_analyzed" : ",".join(list(b.project['semmle.sourceLanguage'])), - "automationDetails" : extra, + "automationDetails" : automationDetails, }, index=[0]) # Force all column types to ensure appropriate formatting diff --git a/sarif_cli/signature.py b/sarif_cli/signature.py index 82771a5..59a8e29 100644 --- a/sarif_cli/signature.py +++ b/sarif_cli/signature.py @@ -253,7 +253,8 @@ def fillsig_dict(args, elem, context): # simple sequence tests. if 'results' in elem.keys() and not 'automationDetails' in elem.keys(): - #want this to be blank if not present- ie no submodule info added/no sarif-category used + # Want this to be flagged if not present- ie no submodule info added/no + # sarif-category used full_elem['automationDetails'] = {'id' : "no-value-for-ad"} if {'locations', 'message', 'partialFingerprints', 'ruleId',