Skip to content

Commit b304c14

Browse files
committed
[DOC] Remove outdated documentation about command injection
[Feature #19630] This dangerous behavior was removed in 4.0 (996cae6) but the documentation wasn't updated.
1 parent c342461 commit b304c14

File tree

2 files changed

+0
-49
lines changed

2 files changed

+0
-49
lines changed

doc/security/command_injection.rdoc

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,3 @@ These methods include:
1313
- {\`command` (backtick method)}[rdoc-ref:Kernel#`]
1414
(also called by the expression <tt>%x[command]</tt>).
1515
- IO.popen (when called with other than <tt>"-"</tt>).
16-
17-
Some methods execute a system command only if the given path name starts
18-
with a <tt>|</tt>:
19-
20-
- Kernel.open(command).
21-
- IO.read(command).
22-
- IO.write(command).
23-
- IO.binread(command).
24-
- IO.binwrite(command).
25-
- IO.readlines(command).
26-
- IO.foreach(command).
27-
- URI.open(command).
28-
29-
Note that some of these methods do not execute commands when called
30-
from subclass +File+:
31-
32-
- File.read(path).
33-
- File.write(path).
34-
- File.binread(path).
35-
- File.binwrite(path).
36-
- File.readlines(path).
37-
- File.foreach(path).

io.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8256,9 +8256,6 @@ rb_io_s_sysopen(int argc, VALUE *argv, VALUE _)
82568256
*
82578257
* Creates an IO object connected to the given file.
82588258
*
8259-
* This method has potential security vulnerabilities if called with untrusted input;
8260-
* see {Command Injection}[rdoc-ref:security/command_injection.rdoc].
8261-
*
82628259
* With no block given, file stream is returned:
82638260
*
82648261
* open('t.txt') # => #<File:t.txt>
@@ -12054,10 +12051,6 @@ io_s_foreach(VALUE v)
1205412051
*
1205512052
* Calls the block with each successive line read from the stream.
1205612053
*
12057-
* When called from class \IO (but not subclasses of \IO),
12058-
* this method has potential security vulnerabilities if called with untrusted input;
12059-
* see {Command Injection}[rdoc-ref:security/command_injection.rdoc].
12060-
*
1206112054
* The first argument must be a string that is the path to a file.
1206212055
*
1206312056
* With only argument +path+ given, parses lines from the file at the given +path+,
@@ -12157,10 +12150,6 @@ io_s_readlines(VALUE v)
1215712150
*
1215812151
* Returns an array of all lines read from the stream.
1215912152
*
12160-
* When called from class \IO (but not subclasses of \IO),
12161-
* this method has potential security vulnerabilities if called with untrusted input;
12162-
* see {Command Injection}[rdoc-ref:security/command_injection.rdoc].
12163-
*
1216412153
* The first argument must be a string that is the path to a file.
1216512154
*
1216612155
* With only argument +path+ given, parses lines from the file at the given +path+,
@@ -12246,10 +12235,6 @@ seek_before_access(VALUE argp)
1224612235
* Opens the stream, reads and returns some or all of its content,
1224712236
* and closes the stream; returns +nil+ if no bytes were read.
1224812237
*
12249-
* When called from class \IO (but not subclasses of \IO),
12250-
* this method has potential security vulnerabilities if called with untrusted input;
12251-
* see {Command Injection}[rdoc-ref:security/command_injection.rdoc].
12252-
*
1225312238
* The first argument must be a string that is the path to a file.
1225412239
*
1225512240
* With only argument +path+ given, reads in text mode and returns the entire content
@@ -12317,10 +12302,6 @@ rb_io_s_read(int argc, VALUE *argv, VALUE io)
1231712302
* Behaves like IO.read, except that the stream is opened in binary mode
1231812303
* with ASCII-8BIT encoding.
1231912304
*
12320-
* When called from class \IO (but not subclasses of \IO),
12321-
* this method has potential security vulnerabilities if called with untrusted input;
12322-
* see {Command Injection}[rdoc-ref:security/command_injection.rdoc].
12323-
*
1232412305
*/
1232512306

1232612307
static VALUE
@@ -12421,10 +12402,6 @@ io_s_write(int argc, VALUE *argv, VALUE klass, int binary)
1242112402
* Opens the stream, writes the given +data+ to it,
1242212403
* and closes the stream; returns the number of bytes written.
1242312404
*
12424-
* When called from class \IO (but not subclasses of \IO),
12425-
* this method has potential security vulnerabilities if called with untrusted input;
12426-
* see {Command Injection}[rdoc-ref:security/command_injection.rdoc].
12427-
*
1242812405
* The first argument must be a string that is the path to a file.
1242912406
*
1243012407
* With only argument +path+ given, writes the given +data+ to the file at that path:
@@ -12471,10 +12448,6 @@ rb_io_s_write(int argc, VALUE *argv, VALUE io)
1247112448
* Behaves like IO.write, except that the stream is opened in binary mode
1247212449
* with ASCII-8BIT encoding.
1247312450
*
12474-
* When called from class \IO (but not subclasses of \IO),
12475-
* this method has potential security vulnerabilities if called with untrusted input;
12476-
* see {Command Injection}[rdoc-ref:security/command_injection.rdoc].
12477-
*
1247812451
*/
1247912452

1248012453
static VALUE

0 commit comments

Comments
 (0)