Module: Aikido::Zen::Sinks::Kernel

Defined in:
lib/aikido/zen/sinks/kernel.rb

Defined Under Namespace

Modules: Helpers

Constant Summary collapse

SINK =
Sinks.add("Kernel", scanners: [Scanners::ShellInjectionScanner])

Class Method Summary collapse

Class Method Details

.load_sinks!Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/aikido/zen/sinks/kernel.rb', line 14

def self.load_sinks!
  [::Kernel.singleton_class, ::Kernel].each do |klass|
    klass.class_eval do
      extend Sinks::DSL

      %i[system spawn `].each do |method_name|
        sink_before method_name do |*args|
          # Remove the optional environment argument before the command-line.
          args.shift if args.first.is_a?(Hash)
          Helpers.scan(args.first, method_name)
        end
      end
    end
  end
end