summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/monkey_patches.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-11-04 17:32:11 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-11-09 10:26:13 -0800
commit5c2457952660e3e531e085757fd85c382676a96e (patch)
treeedd18d37fe28c42a81dbe461977e0fb112139394 /lib/puppet/util/monkey_patches.rb
parent555d6bc671a1a9c128d6f66b2d85b011c84761ba (diff)
downloadpuppet-5c2457952660e3e531e085757fd85c382676a96e.tar.gz
puppet-5c2457952660e3e531e085757fd85c382676a96e.tar.xz
puppet-5c2457952660e3e531e085757fd85c382676a96e.zip
maint: prevent fork bombs by disabling ActiveSupport's Kernel.daemonize
ActiveSupport provides a "daemonize" method on all objects that causes the ruby process to fork to the background. This is extremely surprising and dangerous, and some of our spec tests could trigger this accidentally. This patch adds a "daemonize" method to Object which shadows the ActiveSupport version, preventing it from ever being called.
Diffstat (limited to 'lib/puppet/util/monkey_patches.rb')
-rw-r--r--lib/puppet/util/monkey_patches.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb
index 6b5af8350..bdce5ec1d 100644
--- a/lib/puppet/util/monkey_patches.rb
+++ b/lib/puppet/util/monkey_patches.rb
@@ -48,3 +48,11 @@ if RUBY_VERSION == '1.8.7'
end
end
+class Object
+ # ActiveSupport 2.3.x mixes in a dangerous method
+ # that can cause rspec to fork bomb
+ # and other strange things like that.
+ def daemonize
+ raise NotImplementedError, "Kernel.daemonize is too dangerous, please don't try to use it."
+ end
+end