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 tests
Nick Sweeting291eb86eb3e8
diff --git a/tests/test_url_allowlist_security.py b/tests/test_url_allowlist_security.pyindex be5497077..a157243eb 100644--- a/tests/test_url_allowlist_security.py+++ b/tests/test_url_allowlist_security.py@@ -39,7 +39,7 @@ class TestUrlAllowlistSecurity:# Test more complex glob patternsbrowser_profile = BrowserProfile(- allowed_domains=['*.google.com', 'https://wiki.*', '*good.com', 'chrome://version', 'brave://*']+ allowed_domains=['*.google.com', 'https://wiki.org', 'https://good.com', 'chrome://version', 'brave://*'])browser_session = BrowserSession(browser_profile=browser_profile)@@ -75,7 +75,7 @@ class TestUrlAllowlistSecurity:def test_glob_pattern_edge_cases(self):"""Test edge cases for glob pattern matching to ensure proper behavior."""# Test with domains containing glob pattern in the middle- browser_profile = BrowserProfile(allowed_domains=['*.google.com', 'wiki.*'])+ browser_profile = BrowserProfile(allowed_domains=['*.google.com', 'https://wiki.org'])browser_session = BrowserSession(browser_profile=browser_profile)# Verify that 'wiki*' pattern doesn't match domains that merely contain 'wiki' in the middle@@ -87,13 +87,13 @@ class TestUrlAllowlistSecurity:assert browser_session._is_url_allowed('https://mygoogle.company.com') is False# Create context with potentially risky glob pattern that demonstrates security concerns- browser_profile = BrowserProfile(allowed_domains=['*.google.*'])+ browser_profile = BrowserProfile(allowed_domains=['*.google.com', '*.google.co.uk'])browser_session = BrowserSession(browser_profile=browser_profile)# Should match legitimate Google domainsassert browser_session._is_url_allowed('https://www.google.com') is Trueassert browser_session._is_url_allowed('https://mail.google.co.uk') is True- # But could also match potentially malicious domains with a subdomain structure- # This demonstrates why such wildcard patterns can be risky- assert browser_session._is_url_allowed('https://www.google.evil.com') is True+ # Shouldn't match potentially malicious domains with a similar structure+ # This demonstrates why the previous pattern was risky and why it's now rejected+ assert browser_session._is_url_allowed('https://www.google.evil.com') is False