Java/C++: Thread additional models through the shared lib. · ender700/codeql@0725251 · GitHub
Skip to content

Commit 0725251

Browse files
committed
Java/C++: Thread additional models through the shared lib.
1 parent 47dcf05 commit 0725251

7 files changed

Lines changed: 226 additions & 170 deletions

File tree

‎cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll‎

Lines changed: 71 additions & 87 deletions

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
*/
8989

9090
import csharp
91-
import ExternalFlowExtensions
91+
private import ExternalFlowExtensions::Extensions as Extensions
9292
private import DataFlowDispatch
9393
private import DataFlowPrivate
9494
private import DataFlowPublic
@@ -103,7 +103,9 @@ private import codeql.dataflow.internal.AccessPathSyntax as AccessPathSyntax
103103
private import codeql.mad.ModelValidation as SharedModelVal
104104
private import codeql.mad.static.MaD as SharedMaD
105105

106-
private module MaD = SharedMaD::ModelsAsData<Extensions>;
106+
private module MadInput implements SharedMaD::InputSig { }
107+
108+
private module MaD = SharedMaD::ModelsAsData<Extensions, MadInput>;
107109

108110
import MaD
109111

@@ -169,7 +171,7 @@ module ModelValidation {
169171

170172
predicate sourceKind(string kind) { sourceModel(_, _, _, _, _, _, _, kind, _, _) }
171173

172-
predicate neutralKind(string kind) { neutralModel(_, _, _, _, kind, _) }
174+
predicate neutralKind(string kind) { Extensions::neutralModel(_, _, _, _, kind, _) }
173175
}
174176

175177
private module KindVal = SharedModelVal::KindValidation<KindValConfig>;
@@ -186,7 +188,7 @@ module ModelValidation {
186188
summaryModel(namespace, type, _, name, signature, ext, _, _, _, provenance, _) and
187189
pred = "summary"
188190
or
189-
neutralModel(namespace, type, name, signature, _, provenance) and
191+
Extensions::neutralModel(namespace, type, name, signature, _, provenance) and
190192
ext = "" and
191193
pred = "neutral"
192194
|
@@ -229,7 +231,7 @@ private predicate elementSpec(
229231
or
230232
summaryModel(namespace, type, subtypes, name, signature, ext, _, _, _, _, _)
231233
or
232-
neutralModel(namespace, type, name, signature, _, _) and ext = "" and subtypes = true
234+
Extensions::neutralModel(namespace, type, name, signature, _, _) and ext = "" and subtypes = true
233235
}
234236

235237
private predicate elementSpec(
@@ -501,19 +503,17 @@ private predicate interpretSummary(
501503
UnboundCallable c, string input, string output, string kind, string provenance, string model
502504
) {
503505
exists(
504-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
505-
QlBuiltins::ExtensionId madId
506+
string namespace, string type, boolean subtypes, string name, string signature, string ext
506507
|
507508
summaryModel(namespace, type, subtypes, name, signature, ext, input, output, kind, provenance,
508-
madId) and
509-
model = "MaD:" + madId.toString() and
509+
model) and
510510
c = interpretElement(namespace, type, subtypes, name, signature, ext)
511511
)
512512
}
513513

514514
predicate interpretNeutral(UnboundCallable c, string kind, string provenance) {
515515
exists(string namespace, string type, string name, string signature |
516-
neutralModel(namespace, type, name, signature, kind, provenance) and
516+
Extensions::neutralModel(namespace, type, name, signature, kind, provenance) and
517517
c = interpretElement(namespace, type, true, name, signature, "")
518518
)
519519
}

‎csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,9 @@ module SourceSinkInterpretationInput implements
213213
Element e, string output, string kind, Public::Provenance provenance, string model
214214
) {
215215
exists(
216-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
217-
QlBuiltins::ExtensionId madId
216+
string namespace, string type, boolean subtypes, string name, string signature, string ext
218217
|
219-
sourceModel(namespace, type, subtypes, name, signature, ext, output, kind, provenance, madId) and
220-
model = "MaD:" + madId.toString() and
218+
sourceModel(namespace, type, subtypes, name, signature, ext, output, kind, provenance, model) and
221219
e = interpretElement(namespace, type, subtypes, name, signature, ext)
222220
)
223221
}
@@ -226,11 +224,9 @@ module SourceSinkInterpretationInput implements
226224
Element e, string input, string kind, Public::Provenance provenance, string model
227225
) {
228226
exists(
229-
string namespace, string type, boolean subtypes, string name, string signature, string ext,
230-
QlBuiltins::ExtensionId madId
227+
string namespace, string type, boolean subtypes, string name, string signature, string ext
231228
|
232-
sinkModel(namespace, type, subtypes, name, signature, ext, input, kind, provenance, madId) and
233-
model = "MaD:" + madId.toString() and
229+
sinkModel(namespace, type, subtypes, name, signature, ext, input, kind, provenance, model) and
234230
e = interpretElement(namespace, type, subtypes, name, signature, ext)
235231
)
236232
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ private import internal.FlowSummaryImpl::Private::External
9696
private import codeql.mad.ModelValidation as SharedModelVal
9797
private import codeql.mad.static.MaD as SharedMaD
9898

99-
private module MaD = SharedMaD::ModelsAsData<Extensions>;
99+
private module MadInput implements SharedMaD::InputSig { }
100+
101+
private module MaD = SharedMaD::ModelsAsData<Extensions, MadInput>;
100102

101103
import MaD
102104

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

Lines changed: 41 additions & 44 deletions

0 commit comments

Comments
 (0)