forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request github#17246 from michaelnebel/modelgendebug
C#/Java: Add some model generator summary debugging queries.
- Loading branch information
Showing
8 changed files
with
138 additions
and
14 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
csharp/ql/src/utils/modelgenerator/debug/CaptureSummaryModelsPartialPath.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* @name Capture Summary Models Partial Path | ||
* @description Capture Summary Models Partial Path | ||
* @kind path-problem | ||
* @precision low | ||
* @id csharp/utils/modelgenerator/summary-models-partial-path | ||
* @severity info | ||
* @tags modelgenerator | ||
*/ | ||
|
||
import csharp | ||
import utils.modelgenerator.internal.CaptureModels | ||
import PartialFlow::PartialPathGraph | ||
|
||
int explorationLimit() { result = 3 } | ||
|
||
module PartialFlow = PropagateFlow::FlowExplorationFwd<explorationLimit/0>; | ||
|
||
from | ||
PartialFlow::PartialPathNode source, PartialFlow::PartialPathNode sink, | ||
DataFlowSummaryTargetApi api, DataFlow::ParameterNode p | ||
where | ||
PartialFlow::partialFlow(source, sink, _) and | ||
p = source.getNode() and | ||
p.asParameter() = api.getAParameter() | ||
select sink.getNode(), source, sink, "There is flow from a $@ to $@.", source.getNode(), | ||
"parameter", sink.getNode(), "intermediate value" |
24 changes: 24 additions & 0 deletions
24
csharp/ql/src/utils/modelgenerator/debug/CaptureSummaryModelsPath.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* @name Capture Summary Models Path | ||
* @description Capture Summary Models Path | ||
* @kind path-problem | ||
* @precision low | ||
* @id csharp/utils/modelgenerator/summary-models-path | ||
* @severity warning | ||
* @tags modelgenerator | ||
*/ | ||
|
||
import csharp | ||
import utils.modelgenerator.internal.CaptureModels | ||
import PropagateFlow::PathGraph | ||
|
||
from | ||
PropagateFlow::PathNode source, PropagateFlow::PathNode sink, DataFlowSummaryTargetApi api, | ||
DataFlow::Node p, DataFlow::Node returnNodeExt | ||
where | ||
PropagateFlow::flowPath(source, sink) and | ||
p = source.getNode() and | ||
returnNodeExt = sink.getNode() and | ||
exists(captureThroughFlow0(api, p, returnNodeExt)) | ||
select sink.getNode(), source, sink, "There is flow from $@ to the $@.", source.getNode(), | ||
"parameter", sink.getNode(), "return value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The queries in this directory are purely used for model generator debugging purposes in VS Code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
java/ql/src/utils/modelgenerator/debug/CaptureSummaryModelsPartialPath.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* @name Capture Summary Models Partial Path | ||
* @description Capture Summary Models Partial Path | ||
* @kind path-problem | ||
* @precision low | ||
* @id java/utils/modelgenerator/summary-models-partial-path | ||
* @severity info | ||
* @tags modelgenerator | ||
*/ | ||
|
||
import java | ||
import semmle.code.java.dataflow.DataFlow | ||
import utils.modelgenerator.internal.CaptureModels | ||
import PartialFlow::PartialPathGraph | ||
|
||
int explorationLimit() { result = 3 } | ||
|
||
module PartialFlow = PropagateFlow::FlowExplorationFwd<explorationLimit/0>; | ||
|
||
from | ||
PartialFlow::PartialPathNode source, PartialFlow::PartialPathNode sink, | ||
DataFlowSummaryTargetApi api, DataFlow::ParameterNode p | ||
where | ||
PartialFlow::partialFlow(source, sink, _) and | ||
p = source.getNode() and | ||
p.asParameter() = api.getAParameter() | ||
select sink.getNode(), source, sink, "There is flow from a $@ to $@.", source.getNode(), | ||
"parameter", sink.getNode(), "intermediate value" |
25 changes: 25 additions & 0 deletions
25
java/ql/src/utils/modelgenerator/debug/CaptureSummaryModelsPath.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* @name Capture Summary Models Path | ||
* @description Capture Summary Models Path | ||
* @kind path-problem | ||
* @precision low | ||
* @id java/utils/modelgenerator/summary-models-path | ||
* @severity warning | ||
* @tags modelgenerator | ||
*/ | ||
|
||
import java | ||
import semmle.code.java.dataflow.DataFlow | ||
import utils.modelgenerator.internal.CaptureModels | ||
import PropagateFlow::PathGraph | ||
|
||
from | ||
PropagateFlow::PathNode source, PropagateFlow::PathNode sink, DataFlowSummaryTargetApi api, | ||
DataFlow::Node p, DataFlow::Node returnNodeExt | ||
where | ||
PropagateFlow::flowPath(source, sink) and | ||
p = source.getNode() and | ||
returnNodeExt = sink.getNode() and | ||
exists(captureThroughFlow0(api, p, returnNodeExt)) | ||
select sink.getNode(), source, sink, "There is flow from $@ to the $@.", source.getNode(), | ||
"parameter", sink.getNode(), "return value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The queries in this directory are purely used for model generator debugging purposes in VS Code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters