AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(backend): Properly encode hostname in URL validation (#11259)
seer-by-sentry[bot]ff71c940c956
diff --git a/autogpt_platform/backend/backend/util/request.py b/autogpt_platform/backend/backend/util/request.pyindex bbe493265a..298beec5f0 100644--- a/autogpt_platform/backend/backend/util/request.py+++ b/autogpt_platform/backend/backend/util/request.py@@ -175,10 +175,15 @@ async def validate_url(f"for hostname {ascii_hostname} is not allowed.")+ # Reconstruct the netloc with IDNA-encoded hostname and preserve port+ netloc = ascii_hostname+ if parsed.port:+ netloc = f"{ascii_hostname}:{parsed.port}"+return (URL(parsed.scheme,- ascii_hostname,+ netloc,quote(parsed.path, safe="/%:@"),parsed.params,parsed.query,