Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
fix security issue with url parsing
Nick Sweetingebdeb613f7bd
diff --git a/browser_use/browser/context.py b/browser_use/browser/context.pyindex 75461a010..9e06c6c8b 100644--- a/browser_use/browser/context.py+++ b/browser_use/browser/context.py@@ -743,16 +743,15 @@ class BrowserContext:try:from urllib.parse import urlparse- parsed_url = urlparse(url)- domain = parsed_url.netloc.lower()-# Special case: Allow 'about:blank' explicitlyif url == 'about:blank':return True- # Remove port number if present- if ':' in domain:- domain = domain.split(':')[0]+ parsed_url = urlparse(url)++ # Extract only the hostname component (without auth credentials or port)+ # Hostname returns only the domain portion, ignoring username:password and port+ domain = parsed_url.hostname.lower() if parsed_url.hostname else ''# Check if domain matches any allowed domain patternreturn any(