Pravin Mishra
Pravin Mishra

Reputation: 8434

How to block ruby exec commands

Does anybody know how to block/disable ruby exec commands? There are three commands that execute shell commands in ruby: exec, system, and %x() or ``. I want to block/disable these commands.

Upvotes: 2

Views: 425

Answers (1)

Sachin Singh
Sachin Singh

Reputation: 7225

Try this out:

module Kernel
  remove_method :exec
  remove_method :system
  remove_method :`
end

It reopens the Kernel module and and remove the exec and system methods.

Upvotes: 3

Related Questions