summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSytse Sijbrandij <sytse@gitlab.com>2014-10-02 16:32:59 +0000
committerSytse Sijbrandij <sytse@gitlab.com>2014-10-02 16:32:59 +0000
commita835b0ce1771c94d50c69830da4811353be60dcb (patch)
tree3844b625691a6175e4576449917f0b9f92218252
parent4e96c84e587c0dc70225127e03bc531949f5dd88 (diff)
parent97c5d38097a6308c31e0e5f9afaef719d5080b5f (diff)
downloadgitlab-ce-a835b0ce1771c94d50c69830da4811353be60dcb.tar.gz
Merge branch 'be_pragmatic_about_shelling_out' into 'master'
Be pragmatic about shelling out See merge request !1149
-rw-r--r--doc/development/shell_commands.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/development/shell_commands.md b/doc/development/shell_commands.md
index 1f3908f4e27..23c8365c340 100644
--- a/doc/development/shell_commands.md
+++ b/doc/development/shell_commands.md
@@ -22,6 +22,12 @@ FileUtils.mkdir_p "tmp/special/directory"
contents = `cat #{filename}`
# Correct
contents = File.read(filename)
+
+# Sometimes a shell command is just the best solution. The example below has no
+# user input, and is hard to implement correctly in Ruby: delete all files and
+# directories older than 120 minutes under /some/path, but not /some/path
+# itself.
+Gitlab::Popen.popen(%W(find /some/path -not -path /some/path -mmin +120 -delete))
```
This coding style could have prevented CVE-2013-4490.