Skip to content

Commit 340897f

Browse files
committed
ruby: drop unnecessary variable
1 parent a23750a commit 340897f

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

ruby/ql/lib/codeql/ruby/frameworks/Rails.qll

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,14 @@ private predicate hasBooleanValue(DataFlow::Node node, boolean value) {
102102

103103
// `<actionControllerConfig>.allow_forgery_protection = <verificationSetting>`
104104
private DataFlow::CallNode getAnAllowForgeryProtectionCall(boolean verificationSetting) {
105-
exists(ActionControllerConfigNode recv |
106-
// exclude some test and development configuration
107-
not (
108-
result.getLocation().getFile().getRelativePath().matches("%test/%") or
109-
result.getLocation().getFile().getStem() = ["test", "development"]
110-
) and
111-
result.getReceiver() = recv and
112-
result.asExpr().getExpr().(MethodCall).getMethodName() = "allow_forgery_protection=" and
113-
hasBooleanValue(result.getArgument(0), verificationSetting)
114-
)
105+
// exclude some test and development configuration
106+
not (
107+
result.getLocation().getFile().getRelativePath().matches("%test/%") or
108+
result.getLocation().getFile().getStem() = ["test", "development"]
109+
) and
110+
result.getReceiver() instanceof ActionControllerConfigNode and
111+
result.asExpr().getExpr().(MethodCall).getMethodName() = "allow_forgery_protection=" and
112+
hasBooleanValue(result.getArgument(0), verificationSetting)
115113
}
116114

117115
/**

0 commit comments

Comments
 (0)