Module: Aikido::Zen::Sinks

Defined in:
lib/aikido/zen/sink.rb,
lib/aikido/zen/sinks/pg.rb,
lib/aikido/zen/sinks/curb.rb,
lib/aikido/zen/sinks/http.rb,
lib/aikido/zen/sinks/excon.rb,
lib/aikido/zen/sinks/httpx.rb,
lib/aikido/zen/sinks/mysql2.rb,
lib/aikido/zen/sinks/patron.rb,
lib/aikido/zen/sinks/resolv.rb,
lib/aikido/zen/sinks/socket.rb,
lib/aikido/zen/sinks/em_http.rb,
lib/aikido/zen/sinks/sqlite3.rb,
lib/aikido/zen/sinks/trilogy.rb,
lib/aikido/zen/sinks/net_http.rb,
lib/aikido/zen/sinks/typhoeus.rb,
lib/aikido/zen/sinks/async_http.rb,
lib/aikido/zen/sinks/httpclient.rb,
lib/aikido/zen/sinks/action_controller.rb

Defined Under Namespace

Modules: ActionController, Async, Curl, EventMachine, Excon, HTTP, HTTPClient, HTTPX, Mysql2, Net, PG, Patron, Resolv, SQLite3, Socket, Trilogy, Typhoeus

Class Method Summary collapse

Class Method Details

.add(name, scanners:, **opts) ⇒ void

This method returns an undefined value.

Primary interface to set up a sink with a list of given scanners.

Parameters:

  • name (String)

    name of the library being patched. (This must match the name of the gem, or we won’t report that gem as supported.)

  • scanners (Array<#call>)

    a list of objects that respond to #call with a Hash and return an Attack or nil.

  • opts (Hash<Symbol, Object>)

    any other options to pass to the Sink initializer.

Raises:

  • (ArgumentError)

    if a Sink with this name has already been registered.



26
27
28
29
# File 'lib/aikido/zen/sink.rb', line 26

def self.add(name, scanners:, **opts)
  raise ArgumentError, "Sink #{name} already registered" if registry.key?(name.to_s)
  registry[name.to_s] = Sink.new(name.to_s, scanners: scanners, **opts)
end

.registryHash<String, Sink>

Returns:

  • (Hash<String, Sink>)


9
10
11
# File 'lib/aikido/zen/sink.rb', line 9

def self.registry
  @registry ||= {}
end