Class: IuguLogger::Pii::Scanner

Inherits:
Object
  • Object
show all
Defined in:
lib/iugu_logger/pii.rb

Overview

Stateful per-scan orchestrator (Layer 1 + Layer 2). NOT thread-safe —create a new Scanner per log event.

Instance Method Summary collapse

Constructor Details

#initialize(strategies: DEFAULT_STRATEGIES, param_blocklist: DEFAULT_PARAM_BLOCKLIST) ⇒ Scanner

Returns a new instance of Scanner.



156
157
158
159
160
161
# File 'lib/iugu_logger/pii.rb', line 156

def initialize(strategies: DEFAULT_STRATEGIES, param_blocklist: DEFAULT_PARAM_BLOCKLIST)
  @strategies      = strategies
  @param_blocklist = param_blocklist.map { |k| k.to_s.downcase }
  @detected        = []
  @redacted_count  = 0
end

Instance Method Details

#scan(payload) ⇒ Object

Returns a Result with a sanitized deep copy of the payload + detection metadata.



164
165
166
167
# File 'lib/iugu_logger/pii.rb', line 164

def scan(payload)
  sanitized = process(payload)
  Result.new(payload: sanitized, detected: @detected, redacted_count: @redacted_count)
end