util.validation¶
General validation utilities for Trustpoint.
Attributes¶
Exceptions¶
Raised when validation fails. |
Functions¶
|
Validate that the common name contains only safe characters and no URL-like constructs. |
|
Validate that the application URI has a valid scheme and is not HTTP/HTTPS. |
|
Check if an IP address is in a blocked range for SSRF prevention. |
Validate URL scheme and host. |
|
|
Validate URL port number for SSRF prevention. |
|
Validate hostname and resolve to safe IP addresses. |
|
Validate that the webhook URL is safe and doesn't allow SSRF attacks. |
Module Contents¶
- util.validation.validate_common_name_characters(common_name)[source]¶
Validate that the common name contains only safe characters and no URL-like constructs.
- Parameters:
common_name (str)
- Return type:
None
- util.validation.validate_application_uri(application_uri)[source]¶
Validate that the application URI has a valid scheme and is not HTTP/HTTPS.
- Parameters:
application_uri (str)
- Return type:
None
- util.validation._is_ip_blocked(ip)[source]¶
Check if an IP address is in a blocked range for SSRF prevention.
- Parameters:
ip (ipaddress.IPv4Address | ipaddress.IPv6Address)
- Return type:
bool
- util.validation._validate_webhook_scheme_and_host(parsed)[source]¶
Validate URL scheme and host.
- Parameters:
parsed (urllib.parse.ParseResult)
- Return type:
None
- util.validation._validate_webhook_port(parsed)[source]¶
Validate URL port number for SSRF prevention.
- Parameters:
parsed (urllib.parse.ParseResult)
- Return type:
None
- util.validation._validate_webhook_hostname_and_ip(hostname)[source]¶
Validate hostname and resolve to safe IP addresses.
- Parameters:
hostname (str)
- Return type:
None
- util.validation.validate_webhook_url(url)[source]¶
Validate that the webhook URL is safe and doesn’t allow SSRF attacks.
Implements comprehensive SSRF protection following OWASP guidelines: - Input validation and sanitization - URL parsing and scheme validation - Port number restrictions - Hostname validation - DNS resolution and IP address validation - Blocking of private/internal networks
- Parameters:
url (str)
- Return type:
None