Skip to content

Commit bb7e473

Browse files
author
Stephan Brandauer
committed
use the name callable, instead of callee for methods, functions
1 parent f7f6f10 commit bb7e473

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

java/ql/src/Telemetry/AutomodelEndpointCharacteristics.qll

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ module CandidatesImpl implements SharedCharacteristics::CandidateSig {
8888
exists(
8989
string package, string type, boolean subtypes, string name, string signature, string ext,
9090
int input, string provenance, boolean isPublic, boolean isFinal, boolean isStatic,
91-
string calleeJavaDoc
91+
string callableJavaDoc
9292
|
9393
hasMetadata(e, package, type, name, signature, input, isFinal, isStatic, isPublic,
94-
calleeJavaDoc) and
94+
callableJavaDoc) and
9595
(if isFinal = true or isStatic = true then subtypes = false else subtypes = true) and
9696
ext = "" and
9797
/*
@@ -113,7 +113,7 @@ module CandidatesImpl implements SharedCharacteristics::CandidateSig {
113113
+ "', 'Argument index': " + input //
114114
+ ", 'Provenance': '" + provenance //
115115
+ "', 'Is public': " + isPublic //
116-
+ "', 'Callee JavaDoc': '" + calleeJavaDoc.replaceAll("'", "\"") //
116+
+ "', 'Callable JavaDoc': '" + callableJavaDoc.replaceAll("'", "\"") //
117117
+ "'}" // TODO: Why are the curly braces added twice?
118118
)
119119
}
@@ -136,28 +136,28 @@ class Endpoint = CandidatesImpl::Endpoint;
136136
*/
137137
predicate hasMetadata(
138138
Endpoint n, string package, string type, string name, string signature, int input,
139-
boolean isFinal, boolean isStatic, boolean isPublic, string calleeJavaDoc
139+
boolean isFinal, boolean isStatic, boolean isPublic, string callableJavaDoc
140140
) {
141-
exists(Callable callee |
142-
n.asParameter() = callee.getParameter(input) and
143-
package = callee.getDeclaringType().getPackage().getName() and
144-
type = callee.getDeclaringType().getErasure().(RefType).nestedName() and
141+
exists(Callable callable |
142+
n.asParameter() = callable.getParameter(input) and
143+
package = callable.getDeclaringType().getPackage().getName() and
144+
type = callable.getDeclaringType().getErasure().(RefType).nestedName() and
145145
(
146-
if callee.isStatic() or callee.getDeclaringType().isStatic()
146+
if callable.isStatic() or callable.getDeclaringType().isStatic()
147147
then isStatic = true
148148
else isStatic = false
149149
) and
150150
(
151-
if callee.isFinal() or callee.getDeclaringType().isFinal()
151+
if callable.isFinal() or callable.getDeclaringType().isFinal()
152152
then isFinal = true
153153
else isFinal = false
154154
) and
155-
name = callee.getSourceDeclaration().getName() and
156-
signature = ExternalFlow::paramsString(callee) and // TODO: Why are brackets being escaped (`\[\]` vs `[]`)?
157-
(if callee.isPublic() then isPublic = true else isPublic = false) and
158-
if exists(callee.(Documentable).getJavadoc())
159-
then calleeJavaDoc = callee.(Documentable).getJavadoc().toString()
160-
else calleeJavaDoc = ""
155+
name = callable.getSourceDeclaration().getName() and
156+
signature = ExternalFlow::paramsString(callable) and // TODO: Why are brackets being escaped (`\[\]` vs `[]`)?
157+
(if callable.isPublic() then isPublic = true else isPublic = false) and
158+
if exists(callable.(Documentable).getJavadoc())
159+
then callableJavaDoc = callable.(Documentable).getJavadoc().toString()
160+
else callableJavaDoc = ""
161161
)
162162
}
163163

@@ -168,7 +168,7 @@ predicate hasMetadata(
168168
/**
169169
* A negative characteristic that indicates that an is-style boolean method is unexploitable even if it is a sink.
170170
*
171-
* A sink is highly unlikely to be exploitable if its callee's name starts with `is` and the callee has a boolean return
171+
* A sink is highly unlikely to be exploitable if its callable's name starts with `is` and the callable has a boolean return
172172
* type (e.g. `isDirectory`). These kinds of calls normally do only checks, and appear before the proper call that does
173173
* the dangerous/interesting thing, so we want the latter to be modeled as the sink.
174174
*
@@ -188,7 +188,7 @@ private class UnexploitableIsCharacteristic extends CharacteristicsImpl::NotASin
188188
* A negative characteristic that indicates that an existence-checking boolean method is unexploitable even if it is a
189189
* sink.
190190
*
191-
* A sink is highly unlikely to be exploitable if its callee's name is `exists` or `notExists` and the callee has a
191+
* A sink is highly unlikely to be exploitable if its callable's name is `exists` or `notExists` and the callable has a
192192
* boolean return type. These kinds of calls normally do only checks, and appear before the proper call that does the
193193
* dangerous/interesting thing, so we want the latter to be modeled as the sink.
194194
*/
@@ -197,13 +197,13 @@ private class UnexploitableExistsCharacteristic extends CharacteristicsImpl::Not
197197

198198
override predicate appliesToEndpoint(Endpoint e) {
199199
not CandidatesImpl::isSink(e, _) and
200-
exists(Callable callee |
201-
callee = e.getEnclosingCallable() and
200+
exists(Callable callable |
201+
callable = e.getEnclosingCallable() and
202202
(
203-
callee.getName().toLowerCase() = "exists" or
204-
callee.getName().toLowerCase() = "notexists"
203+
callable.getName().toLowerCase() = "exists" or
204+
callable.getName().toLowerCase() = "notexists"
205205
) and
206-
callee.getReturnType() instanceof BooleanType
206+
callable.getReturnType() instanceof BooleanType
207207
)
208208
}
209209
}

0 commit comments

Comments
 (0)