Skip to content

Commit 6b3d458

Browse files
Alvaro Muñozowen-mc
andauthored
Apply suggestions from code review
Co-authored-by: Owen Mansel-Chan <[email protected]>
1 parent c7637a7 commit 6b3d458

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

go/ql/lib/semmle/go/frameworks/Twirp.qll

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -160,21 +160,17 @@ module Twirp {
160160
}
161161
}
162162

163+
163164
/**
164-
* A request coming to the service handler
165+
* A request coming to the service handler.
165166
*/
166-
class Request extends UntrustedFlowSource::Range, DataFlow::ParameterNode {
167-
ServiceHandler handler;
168-
167+
class Request extends UntrustedFlowSource::Range instanceof DataFlow::ParameterNode {
169168
Request() {
170-
handler.getParameter(0).getType().hasQualifiedName("context", "Context") and
171-
handler.getParameter(_) = this.asParameter() and
172-
this.getType().(PointerType).getBaseType() instanceof ProtobufMessageType
173-
}
174-
175-
override predicate isParameterOf(Callable c, int i) {
176-
c.asFunction() = handler and
177-
i = 1
169+
exists(Callable c, ServiceHandler handler | c.asFunction() = handler |
170+
this.isParameterOf(c, 1) and
171+
handler.getParameterType(0).hasQualifiedName("context", "Context") and
172+
this.getType().(PointerType).getBaseType() instanceof ProtobufMessageType
173+
)
178174
}
179175
}
180176
}

0 commit comments

Comments
 (0)