Deprecate Kernel#open and IO support for subprocess creation and forking. This deprecates subprocess creation and forking in - Kernel#open - URI.open - IO.binread - IO.foreach - IO.readlines - IO.read - IO.write This behavior is slated to be removed in Ruby 4.0 [Feature #19630]
32 lines
746 B
Plaintext
32 lines
746 B
Plaintext
== 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:
|
|
|
|
- Kernel.system
|
|
- Kernel.open
|
|
- {\`command` (backtick method)}[rdoc-ref:Kernel#`]
|
|
(also called by the expression <tt>%x[command]</tt>).
|
|
- IO.popen(command).
|
|
- IO.read(command).
|
|
- IO.write(command).
|
|
- IO.binread(command).
|
|
- IO.binwrite(command).
|
|
- IO.readlines(command).
|
|
- IO.foreach(command).
|
|
- URI.open(command).
|
|
|
|
Note that some of these methods do not execute commands when called
|
|
from subclass \File:
|
|
|
|
- File.read(path).
|
|
- File.write(path).
|
|
- File.binread(path).
|
|
- File.binwrite(path).
|
|
- File.readlines(path).
|
|
- File.foreach(path).
|