Module: Olyx::Guardrails::Checks::LengthCheck

Defined in:
lib/olyx/guardrails/checks/length_check.rb

Overview

Enforces the bounded-input invariant before content scanners run.

Class Method Summary collapse

Class Method Details

.call(source, policy) ⇒ Object



10
11
12
13
14
# File 'lib/olyx/guardrails/checks/length_check.rb', line 10

def call(source, policy)
  length = source.length
  maximum = policy.max_input_length
  { type: 'length', allowed: length <= maximum, length: length, max_length: maximum }
end