Merge branch 'main' into static-useInstanceOf

This commit is contained in:
erik-krogh
2022-12-12 15:36:54 +01:00
156 changed files with 2812 additions and 1106 deletions

View File

@@ -1,8 +1,8 @@
/**
* @name Capture negative summary models.
* @description Finds negative summary models to be used by other queries.
* @name Capture neutral models.
* @description Finds neutral models to be used by other queries.
* @kind diagnostic
* @id java/utils/model-generator/negative-summary-models
* @id java/utils/model-generator/neutral-models
* @tags model-generator
*/

View File

@@ -2,7 +2,6 @@
# Tool to regenerate existing framework CSV models.
from pathlib import Path
import json
import os
import shutil
@@ -37,7 +36,7 @@ def regenerateModel(lgtmSlug, extractedDb):
modelFile = lgtmSlugToModelFile[lgtmSlug]
codeQlRoot = findGitRoot()
subprocess.check_call([codeQlRoot + "/java/ql/src/utils/model-generator/GenerateFlowModel.py",
"--with-summaries", "--with-sinks", "--with-negative-summaries",
"--with-summaries", "--with-sinks", "--with-neutrals",
extractedDb, modelFile])
print("Regenerated " + modelFile)
shutil.rmtree(tmpDir)

View File

@@ -1,7 +1,7 @@
/**
* @name Extract MaD negative summary model rows.
* @description This extracts the Models as data negative summary model rows.
* @id java/utils/modelconverter/generate-data-extensions-negative-summary
* @name Extract MaD neutral model rows.
* @description This extracts the Models as data neutral model rows.
* @id java/utils/modelconverter/generate-data-extensions-neutral
*/
import java
@@ -9,6 +9,6 @@ import semmle.code.java.dataflow.ExternalFlow
from string package, string type, string name, string signature, string provenance
where
negativeSummaryModel(package, type, name, signature, provenance) and
neutralModel(package, type, name, signature, provenance) and
provenance != "generated"
select package, type, name, signature, provenance order by package, type, name, signature

View File

@@ -58,9 +58,7 @@ private string asSummaryModel(TargetApiSpecific api, string input, string output
+ "generated"
}
string asNegativeSummaryModel(TargetApiSpecific api) {
result = asPartialNegativeModel(api) + "generated"
}
string asNeutralModel(TargetApiSpecific api) { result = asPartialNeutralModel(api) + "generated" }
/**
* Gets the value summary model for `api` with `input` and `output`.

View File

@@ -131,9 +131,9 @@ string asPartialModel(TargetApiSpecific api) {
}
/**
* Computes the first 4 columns for negative CSV rows.
* Computes the first 4 columns for neutral CSV rows.
*/
string asPartialNegativeModel(TargetApiSpecific api) {
string asPartialNeutralModel(TargetApiSpecific api) {
exists(string type, string name, string parameters |
partialModel(api, type, name, parameters) and
result =

View File

@@ -77,10 +77,10 @@ string captureFlow(DataFlowTargetApi api) {
}
/**
* Gets the negative summary for `api`, if any.
* A negative summary is generated, if there does not exist any positive flow.
* Gets the neutral summary for `api`, if any.
* A neutral model is generated, if there does not exist any summary model.
*/
string captureNoFlow(DataFlowTargetApi api) {
not exists(captureFlow(api)) and
result = asNegativeSummaryModel(api)
result = asNeutralModel(api)
}