Module: Aikido::Zen::Sinks::PG

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

Defined Under Namespace

Modules: Extensions

Constant Summary collapse

SINK =
Sinks.add("pg", scanners: [Scanners::SQLInjectionScanner])
WRAP_EXCEPTIONS =

For some reason, the ActiveRecord pg adapter does not wrap exceptions in StatementInvalid, which leads to inconsistent handling. This guarantees that all Zen errors are wrapped in a StatementInvalid, so documentation can be consistent.

if defined?(ActiveRecord::StatementInvalid)
  <<~RUBY
    rescue Aikido::Zen::SQLInjectionError
      raise ActiveRecord::StatementInvalid
  RUBY
end