Why it matters
That is code execution on this server.
How to fix it
Never evaluate request data. Map the request onto an explicit list of allowed methods (case value when "a" then a end) instead of send.
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
class ReportsController < ApplicationController
def show
render json: Report.new.send(params[:kind])
end
endclass ReportsController < ApplicationController
def show
report = Report.new
data = params[:kind] == "weekly" ? report.weekly : report.daily
render json: data
end
endWhat TrustIvan reads
Runs on repository scans of Ruby source once static analysis is turned on (SAST_RULES and the separately built analyzer image); it is off by default.
Weakness classes and references
Related checks
- Open redirect from request input (Ruby)
RubySeverity: Medium
trustivan-ruby-taint-open-redirect - Unsafe reflection from request input (Ruby)
RubySeverity: High
trustivan-ruby-taint-unsafe-reflection - Deserialization from request input (Ruby)
RubySeverity: High
trustivan-ruby-taint-deserialization - Template injection from request input (Ruby)
RubySeverity: High
trustivan-ruby-taint-template-injection - XSS from request input (Ruby)
RubySeverity: High
trustivan-ruby-taint-xss - Regex injection from request input (Ruby)
RubySeverity: Medium
trustivan-ruby-taint-regex-injection
Terms: SAST (static application security testing), Taint analysis, CWE (Common Weakness Enumeration), OWASP Top 10
All static analysis (SAST) checks · The whole catalogue · How this works in TrustIvan · Documentation