[PATCH/puppet 1/1] maint: prevent fork bombs by disabling ActiveSupport's Kernel.daemonize

5 views
Skip to first unread message

Jesse Wolfe

unread,
Nov 9, 2010, 1:29:08 PM11/9/10
to puppe...@googlegroups.com
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.

Signed-off-by: Jesse Wolfe <jes...@gmail.com>
---
lib/puppet/util/monkey_patches.rb | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/lib/puppet/util/monkey_patches.rb b/lib/puppet/util/monkey_patches.rb
index 6b5af83..bdce5ec 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
--
1.7.0.4

Trevor Vaughan

unread,
Nov 12, 2010, 4:34:31 AM11/12/10
to puppe...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nice! I got hit by this the other day.

Trevor

- --
Trevor Vaughan
Vice President, Onyx Point, Inc.
email: tvau...@onyxpoint.com
phone: 410-541-ONYX (6699)
pgp: 0x6C701E94

- -- This account not approved for unencrypted sensitive information --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBAgAGBQJM3QohAAoJECNCGV1OLcypKBsIAJVUEzc+KIryu+0MF+iMrULC
p+aJ2JJEY3SvP/6KVe0eIUQ6Wo7CQrIUV9D5bFy/VMiQIK6cKUfNF0hejDtdJIal
Q/LJbYb/5W6zlE82xCOvyLJEfzCDKcgnNCTRa11Q+eZG6u6S6TpZ/gci79G0GQpt
XWTPhzgqnmz8d7OXosD36fw5oOs1i5BT7XfnBQzNWm9xEKtYqU1hiQAc/bUhirC0
Ypl08GwX/4agnOvXZ8HE0hikOMt7ah99iKnskFRqgbAVLeV/+stx5/tY1ez4S3d+
430zXd4bCMGtpVO4OYcbL5XQOBgDBGlUYBmdpVO40nl2Uk/+Janh6MbIJ0Qb9Lk=
=u7sd
-----END PGP SIGNATURE-----

tvaughan.vcf
Reply all
Reply to author
Forward
0 new messages