Skip to content
guide · Ruby 4.0

Command Injection

Some Ruby core methods accept string data that includes text to be executed as a system command.

They should not be called with unknown or unsanitized commands.

These methods include:

Some methods execute a system command only if the given path name starts with a |:

Note that some of these methods do not execute commands when called from subclass File:

From doc/security/command_injection.rdoc in Ruby 4.0. View on GitHub ↗ docs.ruby-lang.org ↗