Skip to content

Commit cfcf490

Browse files
authored
fix: Webhook provider uses dummy payload for validation (#5320)
1 parent 41d225d commit cfcf490

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

keep/providers/webhook_provider/webhook_provider.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,12 @@ def dispose(self):
124124

125125
def validate_scopes(self) -> dict[str, bool | str]:
126126
validated_scopes = {}
127-
# try to send the webhook with TEST payload
128127
try:
129-
self._notify(body={"test": "payload"})
128+
self.__validate_url(str(self.authentication_config.url))
129+
validated_scopes["send_webhook"] = True
130130
except Exception as e:
131-
self.logger.exception("Error validating scopes")
131+
self.logger.exception("Error validating webhook URL")
132132
validated_scopes["send_webhook"] = str(e)
133-
return validated_scopes
134-
validated_scopes["send_webhook"] = True
135133
return validated_scopes
136134

137135
def validate_config(self):

tests/e2e_tests/test_end_to_end.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,15 +367,16 @@ def test_provider_deletion(browser: Page):
367367
f"button:has-text('Webhook'):has-text('Connected'):has-text('{provider_name}')"
368368
).click()
369369
browser.get_by_placeholder("Enter url").clear()
370-
browser.get_by_placeholder("Enter url").fill("https://this_is_UwU")
370+
# Use a blacklisted URL to trigger validation error
371+
browser.get_by_placeholder("Enter url").fill("https://metadata.google.internal/test")
371372

372373
browser.get_by_role("button", name="Update", exact=True).click()
373374
browser.wait_for_timeout(500)
374375
# Refreshing the scope
375376
browser.get_by_role("button", name="Validate Scopes", exact=True).click()
376377
browser.wait_for_timeout(500)
377378
assert_scope_text_count(
378-
browser=browser, contains_text="HTTPSConnectionPool", count=1
379+
browser=browser, contains_text="blacklisted", count=1
379380
)
380381
browser.mouse.click(10, 10)
381382
delete_provider(

0 commit comments

Comments
 (0)