Class: Webhooks::Outgoing::UriFiltering::AllowedUriValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
app/models/concerns/webhooks/outgoing/uri_filtering.rb

Overview

Users of this gem are strongly enouraged to add additional cidr ranges and hostnames to the appropriate lists and/or implement ‘custom_block_callback`. At the very least you should add the public hostname that your application uses to the blocked_hostnames list.

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



41
42
43
44
45
46
# File 'app/models/concerns/webhooks/outgoing/uri_filtering.rb', line 41

def validate_each(record, attribute, value)
  uri = URI.parse(value)
  unless record.allowed_uri?(uri)
    record.errors.add attribute, "is not an allowed uri"
  end
end