Skip to content

Commit 68c3c16

Browse files
committed
Ruby: enable forgery protection checks for development environments
1 parent 556cdba commit 68c3c16

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ private predicate hasBooleanValue(DataFlow::Node node, boolean value) {
106106

107107
// `<actionControllerConfig>.allow_forgery_protection = <verificationSetting>`
108108
private DataFlow::CallNode getAnAllowForgeryProtectionCall(boolean verificationSetting) {
109-
// exclude some test and development configuration
109+
// exclude some test configuration
110110
not (
111111
result.getLocation().getFile().getRelativePath().matches("%test/%") or
112-
result.getLocation().getFile().getStem() = ["test", "development"]
112+
result.getLocation().getFile().getStem() = "test"
113113
) and
114114
result.getReceiver() instanceof ActionControllerConfigNode and
115115
result.asExpr().getExpr().(MethodCall).getMethodName() = "allow_forgery_protection=" and
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
| railsapp/app/controllers/users_controller.rb:4:3:4:47 | call to skip_before_action | Potential CSRF vulnerability due to forgery protection being disabled. |
22
| railsapp/config/application.rb:15:5:15:53 | call to allow_forgery_protection= | Potential CSRF vulnerability due to forgery protection being disabled. |
3+
| railsapp/config/environments/development.rb:5:3:5:51 | call to allow_forgery_protection= | Potential CSRF vulnerability due to forgery protection being disabled. |
34
| railsapp/config/environments/production.rb:5:3:5:51 | call to allow_forgery_protection= | Potential CSRF vulnerability due to forgery protection being disabled. |

0 commit comments

Comments
 (0)