Skip to content

Commit be4c223

Browse files
committed
C#: Avoid generating new source models on 'file' kind sources.
1 parent a83ab79 commit be4c223

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

csharp/ql/src/utils/model-generator/internal/CaptureModels.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ string captureSource(TargetApi api) {
234234
config.hasFlow(source, sink) and
235235
ExternalFlow::sourceNode(source, kind) and
236236
api = sink.getEnclosingCallable() and
237+
isRelevantSourceKind(kind) and
237238
result = asSourceModel(api, returnNodeAsOutput(sink), kind)
238239
)
239240
}

csharp/ql/src/utils/model-generator/internal/CaptureModelsSpecific.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,9 @@ string asInputArgument(DataFlow::Node source) {
193193
*/
194194
bindingset[kind]
195195
predicate isRelevantSinkKind(string kind) { any() }
196+
197+
/**
198+
* Holds if `kind` is a relevant source kind for creating source models.
199+
*/
200+
bindingset[kind]
201+
predicate isRelevantSourceKind(string kind) { not kind = "file" }

java/ql/src/utils/model-generator/internal/CaptureModels.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ string captureSource(TargetApi api) {
234234
config.hasFlow(source, sink) and
235235
ExternalFlow::sourceNode(source, kind) and
236236
api = sink.getEnclosingCallable() and
237+
isRelevantSourceKind(kind) and
237238
result = asSourceModel(api, returnNodeAsOutput(sink), kind)
238239
)
239240
}

java/ql/src/utils/model-generator/internal/CaptureModelsSpecific.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,9 @@ predicate isRelevantSinkKind(string kind) {
259259
not kind.matches("regex-use%") and
260260
not kind = "write-file"
261261
}
262+
263+
/**
264+
* Holds if `kind` is a relevant source kind for creating source models.
265+
*/
266+
bindingset[kind]
267+
predicate isRelevantSourceKind(string kind) { any() }

0 commit comments

Comments
 (0)