Module: Olyx::Guardrails::Secrets::PrivateNetworkValidator

Defined in:
lib/olyx/guardrails/secrets/private_network_validator.rb

Overview

Rejects private-network candidates with impossible IPv4 octets.

Constant Summary collapse

ADDRESS =
/\b(?:10|172|192)\.(?:\d{1,3}\.){2}\d{1,3}\b/

Class Method Summary collapse

Class Method Details

.call(value) ⇒ Object



12
13
14
15
# File 'lib/olyx/guardrails/secrets/private_network_validator.rb', line 12

def call(value)
  address = value[ADDRESS]
  address&.split('.')&.all? { |octet| octet.to_i.between?(0, 255) }
end