fix: validate webhook URL scheme to prevent SSRF via urllib
security/scan 1 findings, 0 blocking
security / scan (pull_request) Successful in 1m4s
security/review 0 findings, 0 blocking
security / review (pull_request) Successful in 1m30s
security / deep-audit (pull_request) Skipped

This commit is contained in:
dev1-playground-agent
2026-08-25 07:42:47 +00:00
parent 559ca6ddb7
commit 003091d96b
+5
View File
@@ -280,6 +280,11 @@ class OrdersHandler(BaseHTTPRequestHandler):
try:
import urllib.request
import json
import urllib.parse
parsed = urllib.parse.urlparse(webhook_url)
if parsed.scheme not in ("http", "https"):
print(f"Webhook notification blocked: invalid scheme '{parsed.scheme}'")
return
data = json.dumps({"email": email, "note_id": note_id}).encode()
req = urllib.request.Request(webhook_url, data=data, headers={"Content-Type": "application/json"})
urllib.request.urlopen(req, timeout=10)