Skip to content

Commit 48105db

Browse files
author
Max Schaefer
committed
Fix isNeutral predicates.
1 parent 4b9443e commit 48105db

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

java/ql/automodel/src/AutomodelApplicationModeCharacteristics.qll

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,14 @@ module ApplicationCandidatesImpl implements SharedCharacteristics::CandidateSig
274274
}
275275

276276
predicate isNeutral(Endpoint e) {
277-
exists(string package, string type, string name, string signature |
277+
exists(string package, string type, string name, string signature, string endpointType |
278278
sinkSpec(e, package, type, _, name, signature, _, _) and
279-
ExternalFlow::neutralModel(package, type, name, [signature, ""], "sink", _)
279+
endpointType = "sink"
280+
or
281+
sourceSpec(e, package, type, _, name, signature, _, _) and
282+
endpointType = "source"
283+
|
284+
ExternalFlow::neutralModel(package, type, name, [signature, ""], endpointType, _)
280285
)
281286
}
282287

java/ql/automodel/src/AutomodelFrameworkModeCharacteristics.qll

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,14 @@ module FrameworkCandidatesImpl implements SharedCharacteristics::CandidateSig {
230230
}
231231

232232
predicate isNeutral(Endpoint e) {
233-
exists(string package, string type, string name, string signature |
234-
sinkSpec(e, package, type, _, name, signature, _, _)
233+
exists(string package, string type, string name, string signature, string endpointType |
234+
sinkSpec(e, package, type, _, name, signature, _, _) and
235+
endpointType = "sink"
235236
or
236-
sourceSpec(e, package, type, _, name, signature, _, _)
237+
sourceSpec(e, package, type, _, name, signature, _, _) and
238+
endpointType = "source"
237239
|
238-
ExternalFlow::neutralModel(package, type, name, [signature, ""], "sink", _)
240+
ExternalFlow::neutralModel(package, type, name, [signature, ""], endpointType, _)
239241
)
240242
}
241243

java/ql/automodel/test/AutomodelFrameworkModeExtraction/java/io/File.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package java.io;
22

33
public class File {
4-
public int compareTo( // $ negativeSinkExample=compareTo(File):Argument[this] negativeSourceExample=compareTo(File):Parameter[this] // modeled as neutral
5-
File pathname // $ negativeSinkExample=compareTo(File):Argument[0] negativeSourceExample=compareTo(File):Parameter[0] // modeled as neutral
4+
public int compareTo( // $ negativeSinkExample=compareTo(File):Argument[this] sourceModelCandidate=compareTo(File):Parameter[this] // modeled as neutral for sinks
5+
File pathname // $ negativeSinkExample=compareTo(File):Argument[0] sourceModelCandidate=compareTo(File):Parameter[0] // modeled as neutral for sinks
66
) {
77
return 0;
88
}

0 commit comments

Comments
 (0)