Skip to content
vetkitChecksChangelogDocumentation

vetkit.ruby.code-injection.constantize

A class is looked up from request input (constantize / const_get). Attackers can instantiate or call arbitrary classes, a known path to remote code execution.

Last updated:

Suite: Security

ruby

A class is looked up from request input (constantize / const_get). Attackers can instantiate or call arbitrary classes, a known path to remote code execution.

Category: SECURITY · Engine rule severity: ERROR

How to fix it

Resolve the class from an explicit allow-list (e.g. { "csv" => CsvExport }.fetch(params[:format])).

References

Source: packages/engine/rules/sast/ruby.yml.

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.