Use of reflection influenced by user input detected.
- Rule ID: ruby_lang_reflection_using_user_input
- Languages: ruby
- Source: reflection_using_user_input.yml
Description
Applications should not look up or manipulate code using user-supplied data.
Remediations
❌ Avoid using user input when using reflection:
method(params[:method])
✅ Use user input indirectly when using reflection:
method_name =
case params[:action]
when "option1"
"method1"
when "option2"
"method2"
end
method(method_name)
Resources
Associated CWE
OWASP Top 10
Configuration
To skip this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --skip-rule=ruby_lang_reflection_using_user_input
To run only this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --only-rule=ruby_lang_reflection_using_user_input
Ready to take the next step? Learn more about Bearer Cloud.