mirror of
https://github.com/browser-use/browser-use
synced 2026-04-22 17:45:09 +02:00
fix Selenium wss:// handling and webhook JSON parse guard
This commit is contained in:
@@ -105,7 +105,7 @@ from selenium.webdriver.chrome.options import Options
|
||||
browser_session = await client.browsers.create(proxy_country_code="us")
|
||||
|
||||
options = Options()
|
||||
options.debugger_address = browser_session.cdp_url.replace("ws://", "").replace("/devtools/browser/", "")
|
||||
options.debugger_address = browser_session.cdp_url.replace("wss://", "").replace("ws://", "").replace("/devtools/browser/", "")
|
||||
driver = webdriver.Chrome(options=options)
|
||||
|
||||
driver.get("https://example.com")
|
||||
|
||||
@@ -88,7 +88,10 @@ def verify_webhook(body: bytes, signature: str, timestamp: str, secret: str) ->
|
||||
return False
|
||||
if abs(time.time() - ts) > 300:
|
||||
return False
|
||||
payload = json.loads(body)
|
||||
try:
|
||||
payload = json.loads(body)
|
||||
except (json.JSONDecodeError, ValueError):
|
||||
return False
|
||||
message = f"{timestamp}.{json.dumps(payload, separators=(',', ':'), sort_keys=True)}"
|
||||
expected = hmac.new(secret.encode(), message.encode(), hashlib.sha256).hexdigest()
|
||||
return hmac.compare_digest(expected, signature)
|
||||
|
||||
Reference in New Issue
Block a user