10 lines
306 B
Python
10 lines
306 B
Python
from urllib.parse import urlparse
|
|
|
|
ALLOWED_SCHEMES = {"http", "https"}
|
|
|
|
|
|
def validate_outbound_url(url: str) -> str:
|
|
parsed = urlparse(url.strip())
|
|
if parsed.scheme not in ALLOWED_SCHEMES or not parsed.netloc:
|
|
raise ValueError("Only http and https URLs are allowed")
|
|
return url.strip()
|