From 75b13da4e422c6f00519b51a3d29017cebf40aab Mon Sep 17 00:00:00 2001 From: Harry Maclean Date: Tue, 30 Jan 2024 08:53:32 +0000 Subject: [PATCH] Ruby: Block flow from LHS of && expressions The only values that can flow from the LHS of an && expression are `false` and `nil`, neither of which seem relevant for any of our queries. --- ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll b/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll index 4cc587acaab..4d139a2afef 100644 --- a/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll +++ b/ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll @@ -220,8 +220,10 @@ module LocalFlow { or nodeTo.asExpr() = any(CfgNodes::ExprNodes::BinaryOperationCfgNode op | - op.getExpr() instanceof BinaryLogicalOperation and + op.getExpr() instanceof LogicalOrExpr and nodeFrom.asExpr() = op.getAnOperand() + or + op.getExpr() instanceof LogicalAndExpr and nodeFrom.asExpr() = op.getRightOperand() ) or nodeTo.(ParameterNodeImpl).getParameter() =