Class: SystemHookUrlValidator

Inherits:
PublicUrlValidator show all
Defined in:
app/validators/system_hook_url_validator.rb

Overview

SystemHookUrlValidator

Custom validator specific to SystemHook URLs. This validator works like AddressableUrlValidator but it blocks urls pointing to localhost or the local network depending on ApplicationSetting.allow_local_requests_from_system_hooks

Example:

class SystemHook < WebHook
  validates :url, system_hook_url: true
end

Constant Summary

Constants inherited from PublicUrlValidator

PublicUrlValidator::DEFAULT_OPTIONS

Constants inherited from AddressableUrlValidator

AddressableUrlValidator::BLOCKER_VALIDATE_OPTIONS, AddressableUrlValidator::DEFAULT_OPTIONS

Instance Attribute Summary

Attributes inherited from AddressableUrlValidator

#record

Class Method Summary collapse

Methods inherited from PublicUrlValidator

#initialize

Methods inherited from AddressableUrlValidator

#initialize, #validate_each

Constructor Details

This class inherits a constructor from PublicUrlValidator

Class Method Details

.allow_setting_local_requests?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/validators/system_hook_url_validator.rb', line 15

def self.allow_setting_local_requests?
  ApplicationSetting.current&.allow_local_requests_from_system_hooks?
end