should_allow_host

View as MarkdownOpen in Claude

Check if a host is in the allowed hosts list.

Parameters

host
strRequired

The hostname to check.

Returns

bool — True if the host is allowed (or if allowed_hosts contains "*").

Example

from signalwire.core.security_config import SecurityConfig
security = SecurityConfig()
security.allowed_hosts = ["agent.example.com", "api.example.com"]
print(security.should_allow_host("agent.example.com")) # True
print(security.should_allow_host("evil.example.com")) # False