Unsanitized user input in format string
- Rule ID: ruby_lang_format_string_using_user_input
- Languages: ruby
- Source: format_string_using_user_input.yml
Description
If an application includes user input directly in a format string, an attacker can use format specifiers in the user input to produce misleading or fabricated messages.
Remediations
❌ Avoid format strings containing user input:
sprintf("The value was #{params[:value]}")
✅ Use a literal format string with additional arguments:
sprintf("The value was %s", params[:value])
Associated CWE
Configuration
To skip this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --skip-rule=ruby_lang_format_string_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_format_string_using_user_input