Skip to content

Commit af7b295

Browse files
committed
Address review comments
1 parent 3e3ea51 commit af7b295

File tree

7 files changed

+38
-43
lines changed

7 files changed

+38
-43
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/internal/ExternalFlow.qll

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
*/
8888

8989
import csharp
90+
import ExternalFlowExtensions
9091
private import AccessPathSyntax
9192
private import DataFlowDispatch
9293
private import DataFlowPrivate
@@ -96,37 +97,6 @@ private import FlowSummaryImpl::Private::External
9697
private import FlowSummaryImplSpecific
9798
private import codeql.mad.ModelValidation as SharedModelVal
9899

99-
/**
100-
* Holds if a source model exists for the given parameters.
101-
*/
102-
extensible predicate sourceModel(
103-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
104-
string output, string kind, string provenance
105-
);
106-
107-
/**
108-
* Holds if a sink model exists for the given parameters.
109-
*/
110-
extensible predicate sinkModel(
111-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
112-
string input, string kind, string provenance
113-
);
114-
115-
/**
116-
* Holds if a summary model exists for the given parameters.
117-
*/
118-
extensible predicate summaryModel(
119-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
120-
string input, string output, string kind, string provenance
121-
);
122-
123-
/**
124-
* Holds if a neutral model exists for the given parameters.
125-
*/
126-
extensible predicate neutralModel(
127-
string namespace, string type, string name, string signature, string kind, string provenance
128-
);
129-
130100
private predicate relevantNamespace(string namespace) {
131101
sourceModel(namespace, _, _, _, _, _, _, _, _) or
132102
sinkModel(namespace, _, _, _, _, _, _, _, _) or
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* This module provides extensible predicates for defining MaD models.
3+
*/
4+
5+
/**
6+
* Holds if a source model exists for the given parameters.
7+
*/
8+
extensible predicate sourceModel(
9+
string namespace, string type, boolean subtypes, string name, string signature, string ext,
10+
string output, string kind, string provenance
11+
);
12+
13+
/**
14+
* Holds if a sink model exists for the given parameters.
15+
*/
16+
extensible predicate sinkModel(
17+
string namespace, string type, boolean subtypes, string name, string signature, string ext,
18+
string input, string kind, string provenance
19+
);
20+
21+
/**
22+
* Holds if a summary model exists for the given parameters.
23+
*/
24+
extensible predicate summaryModel(
25+
string namespace, string type, boolean subtypes, string name, string signature, string ext,
26+
string input, string output, string kind, string provenance
27+
);
28+
29+
/**
30+
* Holds if a neutral model exists for the given parameters.
31+
*/
32+
extensible predicate neutralModel(
33+
string namespace, string type, string name, string signature, string kind, string provenance
34+
);

docs/codeql/codeql-language-guides/extensible-predicates.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ About extensible predicates
2222

2323
At a high level, there are two main components to using data extensions. The query writer defines one or more extensible predicates in their query libraries. CLI and code scanning users who want to augment these predicates supply one or more extension files whose data gets injected into the extensible predicate during evaluation. The extension files are either stored directly in the repository where the codebase to be analyzed is hosted, or downloaded as CodeQL model packs.
2424

25-
This example of an extensible predicate for a source is taken from the core Java libraries https://github.com/github/codeql/blob/main/java/ql/lib/semmle/code/java/dataflow/ExternalFlowExtensions.qll#L8-L11
25+
This example of an extensible predicate for a source is taken from the core Java libraries https://github.com/github/codeql/blob/main/java/ql/lib/semmle/code/java/dataflow/internal/ExternalFlowExtensions.qll#L8-L11
2626

2727
.. code-block:: ql
2828

go/ql/lib/semmle/go/dataflow/ExternalFlow.qll

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,14 @@
7474
*/
7575

7676
private import go
77-
private import ExternalFlowExtensions as Extensions
77+
import internal.ExternalFlowExtensions
7878
private import internal.DataFlowPrivate
7979
private import internal.FlowSummaryImpl::Private::External
8080
private import internal.FlowSummaryImplSpecific
8181
private import internal.AccessPathSyntax
8282
private import FlowSummary
8383
private import codeql.mad.ModelValidation as SharedModelVal
8484

85-
/** Holds if a source model exists for the given parameters. */
86-
predicate sourceModel = Extensions::sourceModel/9;
87-
88-
/** Holds if a sink model exists for the given parameters. */
89-
predicate sinkModel = Extensions::sinkModel/9;
90-
91-
/** Holds if a summary model exists for the given parameters. */
92-
predicate summaryModel = Extensions::summaryModel/10;
93-
9485
/** Holds if `package` have MaD framework coverage. */
9586
private predicate packageHasMaDCoverage(string package) {
9687
sourceModel(package, _, _, _, _, _, _, _, _) or

java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private import internal.DataFlowPrivate
9393
private import internal.FlowSummaryImpl::Private::External
9494
private import internal.FlowSummaryImplSpecific as FlowSummaryImplSpecific
9595
private import internal.AccessPathSyntax
96-
private import ExternalFlowExtensions as Extensions
96+
private import internal.ExternalFlowExtensions as Extensions
9797
private import FlowSummary
9898
private import codeql.mad.ModelValidation as SharedModelVal
9999

0 commit comments

Comments
 (0)