summaryrefslogtreecommitdiffstats
path: root/lib/puppet/rails/benchmark.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix for temporary file security wholeMarkus Roberts2010-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | We create temporary files in /tmp/ with predictable names. These could be used by an attacker to DoS a box by setting a symlink to some other file (say, /etc/shadow) and waiting for us to overwrite it. The minimalistic solution employed by this patch is to wrap all such file writing with a paranoid wrapper that: 1) Check to see if the target exists 2) Issues a warning if it was a symlink 3) Deletes it 4) Waits (0.1 seconds if it was a file, 5 seconds if it was a symlink) 5) Opens the file with EXCL, which will fail if the file has come back. If this succeeds (as it normally will) it has exactly the same semantics as the original code (a must, as we are right at a release boundary). However, under no circumstances will it follow a preexisting symlink (the operating system guarantees this with EXCL) so the danger of an exploit has been converted into the possibility of a failure, with an appropriate warning.
* renaming a methodLuke Kanies2009-04-221-1/+1
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding a Rails-specific benchmarking moduleLuke Kanies2009-04-221-0/+69
This just slightly simplifies adding lots of time-debug stuff in Rails. Signed-off-by: Luke Kanies <luke@madstop.com>