We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3bacb18 commit 2f1cfa8Copy full SHA for 2f1cfa8
ruby/ql/test/query-tests/security/cwe-089/ActiveRecordInjection.rb
@@ -137,3 +137,17 @@ def yet_another_handler
137
Admin.delete_by(params[:admin_condition])
138
end
139
140
+
141
+class AnnotatedController < ActionController::Base
142
+ def index
143
+ name = params[:user_name]
144
+ # GOOD: string literal arguments not controlled by user are safe for annotations
145
+ users = User.annotate("this is a safe annotation").find_by(user_name: name)
146
+ end
147
148
+ def unsafe_action
149
150
+ # BAD: user input passed into annotations are vulnerable to SQLi
151
+ users = User.annotate("this is an unsafe annotation:#{params[:comment]}").find_by(user_name: name)
152
153
+end
0 commit comments