URL host validation helpers for AWS SNS signing cert and subscribe URLs.
Hardens SigningCertURL and SubscribeURL parsing by:
- Requiring HTTPS scheme
- Validating host matches
sns.<region>.amazonaws.com(.cn)?pattern - Rejecting URLs with userinfo (credentials in URL)
- Requiring
.pemextension for cert URLs
Summary
Functions
Build a hostname regex pattern from a list of allowed AWS regions.
Validate and parse a SigningCertURL.
Validate and parse a SubscribeURL.
Functions
Build a hostname regex pattern from a list of allowed AWS regions.
Matches sns.<region>.amazonaws.com and sns.<region>.amazonaws.com.cn.
Validate and parse a SigningCertURL.
Returns {:ok, uri} on success or {:error, :invalid_cert_url} on failure.
Validate and parse a SubscribeURL.
Returns {:ok, uri} on success or {:error, :invalid_subscribe_url} on failure.