Skip to content

Commit

Permalink
Use Code Review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkaMaul committed Nov 19, 2024
1 parent 06cae62 commit e930265
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 71 deletions.
14 changes: 6 additions & 8 deletions java/src/security/Recursion/Recursion.ql
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ class RecursionSource extends MethodCall {
*/
class ParameterOperation extends Expr {
ParameterOperation() {
this instanceof BinaryExpr
or
this instanceof UnaryAssignExpr and
(this instanceof BinaryExpr or this instanceof UnaryAssignExpr) and
exists(VarAccess va | va.getVariable() = this.getEnclosingCallable().getAParameter() |
this.getAChildExpr+() = va
)
Expand All @@ -44,15 +42,15 @@ class ParameterOperation extends Expr {
module RecursiveConfig implements DataFlow::StateConfigSig {
class FlowState = Method;

predicate isSource(DataFlow::Node node, FlowState state) {
predicate isSource(DataFlow::Node node, FlowState firstMethod) {
node.asExpr() instanceof RecursionSource and
state = node.asExpr().(MethodCall).getCaller()
firstMethod = node.asExpr().(MethodCall).getCaller()
}

predicate isSink(DataFlow::Node node, FlowState state) {
predicate isSink(DataFlow::Node node, FlowState firstMethod) {
node.asExpr() instanceof RecursionSource and
state.calls+(node.asExpr().(MethodCall).getCaller()) and
node.asExpr().(MethodCall).getCallee().calls(state)
firstMethod.calls+(node.asExpr().(MethodCall).getCaller()) and
node.asExpr().(MethodCall).getCallee().calls(firstMethod)
}

predicate isBarrier(DataFlow::Node node) {
Expand Down
Loading

0 comments on commit e930265

Please sign in to comment.