From 4c67c3e0747f92d41de08f381fdcd46aae50fd93 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Mon, 30 May 2022 10:58:17 -0700 Subject: [PATCH 1/9] Enhanced RDoc for FileUtils --- lib/fileutils.rb | 136 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 92 insertions(+), 44 deletions(-) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index f072b77..3aad7ea 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -898,13 +898,15 @@ def copy_stream(src, dest) # | `-- src.txt # `-- src1.txt # + # Keyword arguments: + # # - force: true - attempts to force the move; # if the move includes removing +src+ # (that is, if +src+ and +dest+ are on different devices), # ignores raised exceptions of StandardError and its descendants. # - noop: true - does not move files. - # - secure: true - removes +src+ securely - # by calling FileUtils.remove_entry_secure. + # - secure: true - removes +src+ securely; + # see details at FileUtils.remove_entry_secure. # - verbose: true - prints an equivalent command: # # FileUtils.mv('src0', 'dest0', noop: true, verbose: true) @@ -949,13 +951,27 @@ def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil) alias move mv module_function :move + # Removes entries at the paths given in array +list+; returns +list+. + # + # With no keyword arguments, returns files at the paths given in +list+: # - # Remove file(s) specified in +list+. This method cannot remove directories. - # All StandardErrors are ignored when the :force option is set. + # FileUtils.touch(['src0.txt', 'src0.dat']) + # FileUtils.rm(['src0.dat', 'src0.txt']) # => ["src0.dat", "src0.txt"] + # + # Keyword arguments: # - # FileUtils.rm %w( junk.txt dust.txt ) - # FileUtils.rm Dir.glob('*.so') - # FileUtils.rm 'NotExistFile', force: true # never raises exception + # - force: true - attempts to remove files regardless of permissions; + # ignores raised exceptions of StandardError and its descendants: + # - noop: true - does not remove files. + # - verbose: true - prints an equivalent command: + # + # FileUtils.rm(['src0.dat', 'src0.txt'], noop: true, verbose: true) + # + # Output: + # + # rm src0.dat src0.txt + # + # FileUtils.remove is an alias for FileUtils.rm. # def rm(list, force: nil, noop: nil, verbose: nil) list = fu_list(list) @@ -971,10 +987,13 @@ def rm(list, force: nil, noop: nil, verbose: nil) alias remove rm module_function :remove + # Equivalent to: # - # Equivalent to + # FileUtils.rm(list, force: true, **kwargs) # - # FileUtils.rm(list, force: true) + # See FileUtils.rm for keyword arguments +noop+ and +verbose+. + # + # FileUtils.safe_unlink is an alias for FileUtils.rm_f. # def rm_f(list, noop: nil, verbose: nil) rm list, force: true, noop: noop, verbose: verbose @@ -984,24 +1003,45 @@ def rm_f(list, noop: nil, verbose: nil) alias safe_unlink rm_f module_function :safe_unlink + # Removes files and directories at the paths given in array +list+; + # returns +list+. # - # remove files +list+[0] +list+[1]... If +list+[n] is a directory, - # removes its all contents recursively. This method ignores - # StandardError when :force option is set. + # For each file path, removes the file at that path: # - # FileUtils.rm_r Dir.glob('/tmp/*') - # FileUtils.rm_r 'some_dir', force: true + # FileUtils.touch(['src0.txt', 'src0.dat']) + # FileUtils.rm_r(['src0.dat', 'src0.txt']) + # File.exist?('src0.txt') # => false + # File.exist?('src0.dat') # => false # - # WARNING: This method causes local vulnerability - # if one of parent directories or removing directory tree are world - # writable (including /tmp, whose permission is 1777), and the current - # process has strong privilege such as Unix super user (root), and the - # system has symbolic link. For secure removing, read the documentation - # of remove_entry_secure carefully, and set :secure option to true. - # Default is secure: false. + # For each directory path, recursively removes files and directories: # - # NOTE: This method calls remove_entry_secure if :secure option is set. - # See also remove_entry_secure. + # system('tree --charset=ascii src1') + # src1 + # |-- dir0 + # | |-- src0.txt + # | `-- src1.txt + # `-- dir1 + # |-- src2.txt + # `-- src3.txt + # FileUtils.rm_r('src1') + # File.exist?('src1') # => false + # + # Keyword arguments: + # + # - force: true - attempts to remove entries regardless of permissions; + # ignores raised exceptions of StandardError and its descendants: + # - noop: true - does not remove entries. + # - secure: true - removes +src+ securely; + # see details at FileUtils.remove_entry_secure. + # - verbose: true - prints an equivalent command: + # + # FileUtils.rm_r(['src0.dat', 'src0.txt'], noop: true, verbose: true) + # FileUtils.rm_r('src1', noop: true, verbose: true) + # + # Output: + # + # rm -r src0.dat src0.txt + # rm -r src1 # def rm_r(list, force: nil, noop: nil, verbose: nil, secure: nil) list = fu_list(list) @@ -1017,13 +1057,15 @@ def rm_r(list, force: nil, noop: nil, verbose: nil, secure: nil) end module_function :rm_r + # Equivalent to: # - # Equivalent to + # FileUtils.rm_r(list, force: true, **kwargs) # - # FileUtils.rm_r(list, force: true) + # See FileUtils.rm_r for keyword arguments +noop+ and +verbose+, + # and especially for keyword argument +secure+, + # which relates to security and vulnerability. # - # WARNING: This method causes local vulnerability. - # Read the documentation of rm_r first. + # FileUtils.rmtree is an alias for FileUtils.rm_rf. # def rm_rf(list, noop: nil, verbose: nil, secure: nil) rm_r list, force: true, noop: noop, verbose: verbose, secure: secure @@ -1033,21 +1075,29 @@ def rm_rf(list, noop: nil, verbose: nil, secure: nil) alias rmtree rm_rf module_function :rmtree + # Securely removes the entry given by +path+, + # which should be the entry for a regular file, a symbolic link, + # or a directory. + # + # Here, "securely" means "avoiding + # {Time-of-check to time-of-use}[https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use] + # vulnerabilities", which can exist when: # - # This method removes a file system entry +path+. +path+ shall be a - # regular file, a directory, or something. If +path+ is a directory, - # remove it recursively. This method is required to avoid TOCTTOU - # (time-of-check-to-time-of-use) local security vulnerability of rm_r. - # #rm_r causes security hole when: + # - An ancestor directory of the entry at +path+ is world writable; + # such directories include /tmp. + # - The directory tree at +path+ includes: # - # * Parent directory is world writable (including /tmp). - # * Removing directory tree includes world writable directory. - # * The system has symbolic link. + # - A world-writable descendant directory. + # - A symbolic link. # - # To avoid this security hole, this method applies special preprocess. - # If +path+ is a directory, this method chown(2) and chmod(2) all - # removing directories. This requires the current process is the - # owner of the removing whole directory tree, or is the super user (root). + # To avoid such a vulnerability, this method applies a special pre-process: + # + # - If +path+ is a directory, this method uses + # {chown(2)}[https://man7.org/linux/man-pages/man2/chown.2.html] + # and {chmod(2)}[https://man7.org/linux/man-pages/man2/chmod.2.html] + # in removing directories. + # - The owner of +path+ should be either the current proces + # or the super user (root). # # WARNING: You must ensure that *ALL* parent directories cannot be # moved by other untrusted users. For example, parent directories @@ -1058,12 +1108,10 @@ def rm_rf(list, noop: nil, verbose: nil, secure: nil) # user (root) should invoke this method. Otherwise this method does not # work. # - # For details of this security vulnerability, see Perl's case: - # - # * https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-0448 - # * https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0452 + # For details of this security vulnerability, see Perl cases: # - # For fileutils.rb, this vulnerability is reported in [ruby-dev:26100]. + # - {CVE-2005-0448}[https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-0448]. + # - {CVE-2004-0452}[https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0452]. # def remove_entry_secure(path, force = false) unless fu_have_symlink? From 65f22f48707fa391679461b89a11c8df2c7df161 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Wed, 1 Jun 2022 13:54:57 -0700 Subject: [PATCH 2/9] Enhanced RDoc --- lib/fileutils.rb | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 3aad7ea..bf751ae 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -951,9 +951,10 @@ def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil) alias move mv module_function :move - # Removes entries at the paths given in array +list+; returns +list+. + # Removes entries at the paths given in +list+, + # which should be a string path or an array of string paths; returns +list+. # - # With no keyword arguments, returns files at the paths given in +list+: + # With no keyword arguments, removes files at the paths given in +list+: # # FileUtils.touch(['src0.txt', 'src0.dat']) # FileUtils.rm(['src0.dat', 'src0.txt']) # => ["src0.dat", "src0.txt"] @@ -961,8 +962,8 @@ def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil) # Keyword arguments: # # - force: true - attempts to remove files regardless of permissions; - # ignores raised exceptions of StandardError and its descendants: - # - noop: true - does not remove files. + # ignores raised exceptions of StandardError and its descendants. + # - noop: true - does not remove files; returns +nil+. # - verbose: true - prints an equivalent command: # # FileUtils.rm(['src0.dat', 'src0.txt'], noop: true, verbose: true) @@ -991,7 +992,7 @@ def rm(list, force: nil, noop: nil, verbose: nil) # # FileUtils.rm(list, force: true, **kwargs) # - # See FileUtils.rm for keyword arguments +noop+ and +verbose+. + # See FileUtils.rm for keyword arguments. # # FileUtils.safe_unlink is an alias for FileUtils.rm_f. # @@ -1006,6 +1007,9 @@ def rm_f(list, noop: nil, verbose: nil) # Removes files and directories at the paths given in array +list+; # returns +list+. # + # May cause a local vulnerability if not called with keyword argument + # secure: true. + # # For each file path, removes the file at that path: # # FileUtils.touch(['src0.txt', 'src0.dat']) @@ -1029,7 +1033,7 @@ def rm_f(list, noop: nil, verbose: nil) # Keyword arguments: # # - force: true - attempts to remove entries regardless of permissions; - # ignores raised exceptions of StandardError and its descendants: + # ignores raised exceptions of StandardError and its descendants. # - noop: true - does not remove entries. # - secure: true - removes +src+ securely; # see details at FileUtils.remove_entry_secure. @@ -1061,9 +1065,10 @@ def rm_r(list, force: nil, noop: nil, verbose: nil, secure: nil) # # FileUtils.rm_r(list, force: true, **kwargs) # - # See FileUtils.rm_r for keyword arguments +noop+ and +verbose+, - # and especially for keyword argument +secure+, - # which relates to security and vulnerability. + # May cause a local vulnerability if not called with keyword argument + # secure: true. + # + # See FileUtils.rm_r for keyword arguments. # # FileUtils.rmtree is an alias for FileUtils.rm_rf. # From 8e653bdea1de8c2e6305f36c1e580ac64cf7af2f Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Wed, 1 Jun 2022 13:59:58 -0700 Subject: [PATCH 3/9] Enhanced RDoc --- lib/fileutils.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index bf751ae..e692dad 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -1034,7 +1034,7 @@ def rm_f(list, noop: nil, verbose: nil) # # - force: true - attempts to remove entries regardless of permissions; # ignores raised exceptions of StandardError and its descendants. - # - noop: true - does not remove entries. + # - noop: true - does not remove entries; returns +nil+. # - secure: true - removes +src+ securely; # see details at FileUtils.remove_entry_secure. # - verbose: true - prints an equivalent command: From 71672b4859671cfe227053f0d1dd0951761aa971 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Thu, 2 Jun 2022 13:04:41 -0700 Subject: [PATCH 4/9] Enhanced RDoc --- lib/fileutils.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index e692dad..8ff1fb3 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -311,7 +311,7 @@ def fu_mkdir(path, mode) #:nodoc: # # Removes directories at the paths in the given +list+ # (an array of strings or a single string); - # returns +list+. + # returns +list+, if it is an array, [list] otherwise. # # With no keyword arguments, removes the directory at each +path+ in +list+, # by calling: Dir.rmdir(path); @@ -900,10 +900,8 @@ def copy_stream(src, dest) # # Keyword arguments: # - # - force: true - attempts to force the move; - # if the move includes removing +src+ - # (that is, if +src+ and +dest+ are on different devices), - # ignores raised exceptions of StandardError and its descendants. + # - force: true - ignores raised exceptions of StandardError + # and its descendants. # - noop: true - does not move files. # - secure: true - removes +src+ securely; # see details at FileUtils.remove_entry_secure. @@ -961,8 +959,8 @@ def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil) # # Keyword arguments: # - # - force: true - attempts to remove files regardless of permissions; - # ignores raised exceptions of StandardError and its descendants. + # - force: true - ignores raised exceptions of StandardError + # and its descendants. # - noop: true - does not remove files; returns +nil+. # - verbose: true - prints an equivalent command: # @@ -1101,7 +1099,7 @@ def rm_rf(list, noop: nil, verbose: nil, secure: nil) # {chown(2)}[https://man7.org/linux/man-pages/man2/chown.2.html] # and {chmod(2)}[https://man7.org/linux/man-pages/man2/chmod.2.html] # in removing directories. - # - The owner of +path+ should be either the current proces + # - The owner of +path+ should be either the current process # or the super user (root). # # WARNING: You must ensure that *ALL* parent directories cannot be From fabcf441eaa01c12df9b80e895ab8da44692ea46 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Thu, 2 Jun 2022 13:21:54 -0700 Subject: [PATCH 5/9] Enhanced RDoc --- lib/fileutils.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 8ff1fb3..d2e1e91 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -197,7 +197,7 @@ def remove_trailing_slash(dir) #:nodoc: # # Creates directories at the paths in the given +list+ # (an array of strings or a single string); - # returns +list+. + # returns +list+ if it is an array, [list] otherwise. # # With no keyword arguments, creates a directory at each +path+ in +list+ # by calling: Dir.mkdir(path, mode); @@ -239,7 +239,7 @@ def mkdir(list, mode: nil, noop: nil, verbose: nil) # Creates directories at the paths in the given +list+ # (an array of strings or a single string), # also creating ancestor directories as needed; - # returns +list+. + # returns +list+ if it is an array, [list] otherwise. # # With no keyword arguments, creates a directory at each +path+ in +list+, # along with any needed ancestor directories, @@ -949,8 +949,9 @@ def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil) alias move mv module_function :move - # Removes entries at the paths given in +list+, - # which should be a string path or an array of string paths; returns +list+. + # Removes entries at the paths in the given +list+ + # (an array of strings or a single string); + # returns +list+, if it is an array, [list] otherwise. # # With no keyword arguments, removes files at the paths given in +list+: # @@ -1002,8 +1003,9 @@ def rm_f(list, noop: nil, verbose: nil) alias safe_unlink rm_f module_function :safe_unlink - # Removes files and directories at the paths given in array +list+; - # returns +list+. + # Removes entries at the paths in the given +list+ + # (an array of strings or a single string); + # returns +list+, if it is an array, [list] otherwise. # # May cause a local vulnerability if not called with keyword argument # secure: true. From cec2e7bc9f2aebd0348b1f3462f5043cb2236a3e Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Fri, 3 Jun 2022 13:58:20 -0700 Subject: [PATCH 6/9] Enhanced RDoc --- lib/fileutils.rb | 104 ++++++++++++++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 37 deletions(-) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index d2e1e91..a75b157 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -101,6 +101,61 @@ # files/directories. This equates to passing the :noop and # :verbose flags to methods in FileUtils. # +# == Avoiding the TOCTTOU Vulnerability +# +# For certain methods that recursively remove entries, +# there is a potential vulnerability called the +# {Time-of-check to time-of-use}[https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use], +# or TOCTTOU, vulnerability that can exist when: +# +# - An ancestor directory of the entry at the target path is world writable; +# such directories include /tmp. +# - The directory tree at the target path includes: +# +# - A world-writable descendant directory. +# - A symbolic link. +# +# To avoid that vulnerability, you can use this method to remove entries: +# +# - FileUtils.remove_entry_secure: removes recursively +# if the target path points to a directory. +# +# Also available are these methods, +# each of which calls \FileUtils.remove_entry_secure: +# +# - FileUtils.rm_r with keyword argument secure: true. +# - FileUtils.rm_rf with keyword argument secure: true. +# +# Finally, this method for moving entries calls \FileUtils.remove_entry_secure +# if the source and destination are on different devices +# (which means that the "move" is really a copy and remove): +# +# - FileUtils.mv with keyword argument secure: true. +# +# \Method \FileUtils.remove_entry_secure remove securely +# by applying a special pre-process: +# +# - If the target path points to a directory, this method uses +# {chown(2)}[https://man7.org/linux/man-pages/man2/chown.2.html] +# and {chmod(2)}[https://man7.org/linux/man-pages/man2/chmod.2.html] +# in removing directories. +# - The owner of the target directory should be either the current process +# or the super user (root). +# +# WARNING: You must ensure that *ALL* parent directories cannot be +# moved by other untrusted users. For example, parent directories +# should not be owned by untrusted users, and should not be world +# writable except when the sticky bit set. +# +# WARNING: Only the owner of the removing directory tree, or Unix super +# user (root) should invoke this method. Otherwise this method does not +# work. +# +# For details of this security vulnerability, see Perl cases: +# +# - {CVE-2005-0448}[https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-0448]. +# - {CVE-2004-0452}[https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0452]. +# module FileUtils VERSION = "1.6.0" @@ -865,6 +920,10 @@ def copy_stream(src, dest) # If +src+ and +dest+ are on different devices, # first copies, then removes +src+. # + # May cause a local vulnerability if not called with keyword argument + # secure: true; + # see {Avoiding the TOCTTOU Vulnerability}[rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability]. + # # If +src+ is the path to a single file or directory and +dest+ does not exist, # moves +src+ to +dest+: # @@ -1008,7 +1067,8 @@ def rm_f(list, noop: nil, verbose: nil) # returns +list+, if it is an array, [list] otherwise. # # May cause a local vulnerability if not called with keyword argument - # secure: true. + # secure: true; + # see {Avoiding the TOCTTOU Vulnerability}[rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability]. # # For each file path, removes the file at that path: # @@ -1032,8 +1092,8 @@ def rm_f(list, noop: nil, verbose: nil) # # Keyword arguments: # - # - force: true - attempts to remove entries regardless of permissions; - # ignores raised exceptions of StandardError and its descendants. + # - force: true - ignores raised exceptions of StandardError + # and its descendants. # - noop: true - does not remove entries; returns +nil+. # - secure: true - removes +src+ securely; # see details at FileUtils.remove_entry_secure. @@ -1066,7 +1126,8 @@ def rm_r(list, force: nil, noop: nil, verbose: nil, secure: nil) # FileUtils.rm_r(list, force: true, **kwargs) # # May cause a local vulnerability if not called with keyword argument - # secure: true. + # secure: true; + # see {Avoiding the TOCTTOU Vulnerability}[rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability]. # # See FileUtils.rm_r for keyword arguments. # @@ -1084,39 +1145,8 @@ def rm_rf(list, noop: nil, verbose: nil, secure: nil) # which should be the entry for a regular file, a symbolic link, # or a directory. # - # Here, "securely" means "avoiding - # {Time-of-check to time-of-use}[https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use] - # vulnerabilities", which can exist when: - # - # - An ancestor directory of the entry at +path+ is world writable; - # such directories include /tmp. - # - The directory tree at +path+ includes: - # - # - A world-writable descendant directory. - # - A symbolic link. - # - # To avoid such a vulnerability, this method applies a special pre-process: - # - # - If +path+ is a directory, this method uses - # {chown(2)}[https://man7.org/linux/man-pages/man2/chown.2.html] - # and {chmod(2)}[https://man7.org/linux/man-pages/man2/chmod.2.html] - # in removing directories. - # - The owner of +path+ should be either the current process - # or the super user (root). - # - # WARNING: You must ensure that *ALL* parent directories cannot be - # moved by other untrusted users. For example, parent directories - # should not be owned by untrusted users, and should not be world - # writable except when the sticky bit set. - # - # WARNING: Only the owner of the removing directory tree, or Unix super - # user (root) should invoke this method. Otherwise this method does not - # work. - # - # For details of this security vulnerability, see Perl cases: - # - # - {CVE-2005-0448}[https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-0448]. - # - {CVE-2004-0452}[https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0452]. + # Avoids a local vulnerability that can exist in certain circumstances; + # see {Avoiding the TOCTTOU Vulnerability}[rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability]. # def remove_entry_secure(path, force = false) unless fu_have_symlink? From 4a9a0f87cc6e5e943683f47a581161d8a2cd5dd1 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Sat, 4 Jun 2022 08:55:43 -0700 Subject: [PATCH 7/9] Enhanced RDoc --- lib/fileutils.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index a75b157..7735b75 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -130,9 +130,9 @@ # if the source and destination are on different devices # (which means that the "move" is really a copy and remove): # -# - FileUtils.mv with keyword argument secure: true. +# - FileUtils.mv `with keyword argument secure: true. # -# \Method \FileUtils.remove_entry_secure remove securely +# \Method \FileUtils.remove_entry_secure removes securely # by applying a special pre-process: # # - If the target path points to a directory, this method uses @@ -145,11 +145,7 @@ # WARNING: You must ensure that *ALL* parent directories cannot be # moved by other untrusted users. For example, parent directories # should not be owned by untrusted users, and should not be world -# writable except when the sticky bit set. -# -# WARNING: Only the owner of the removing directory tree, or Unix super -# user (root) should invoke this method. Otherwise this method does not -# work. +# writable except when the sticky bit is set. # # For details of this security vulnerability, see Perl cases: # From d7fd008d8701dda5f3b01bba4c13a171125bdb43 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Sat, 4 Jun 2022 12:54:21 -0700 Subject: [PATCH 8/9] Enhanced RDoc --- lib/fileutils.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 7735b75..fc41c09 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -130,7 +130,7 @@ # if the source and destination are on different devices # (which means that the "move" is really a copy and remove): # -# - FileUtils.mv `with keyword argument secure: true. +# - FileUtils.mv with keyword argument secure: true. # # \Method \FileUtils.remove_entry_secure removes securely # by applying a special pre-process: From 5163525041d915ddbac7031a55c8de76ec611ddc Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Sun, 5 Jun 2022 10:31:33 -0700 Subject: [PATCH 9/9] Enhanced RDoc --- lib/fileutils.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index fc41c09..cbf7f52 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -955,8 +955,9 @@ def copy_stream(src, dest) # # Keyword arguments: # - # - force: true - ignores raised exceptions of StandardError - # and its descendants. + # - force: true - if the move includes removing +src+ + # (that is, if +src+ and +dest+ are on different devices), + # ignores raised exceptions of StandardError and its descendants. # - noop: true - does not move files. # - secure: true - removes +src+ securely; # see details at FileUtils.remove_entry_secure.