delei commented on code in PR #3779:
URL: https://github.com/apache/hertzbeat/pull/3779#discussion_r2363681514
##########
hertzbeat-alerter/src/main/java/org/apache/hertzbeat/alert/notice/impl/WebHookAlertNotifyHandlerImpl.java:
##########
@@ -39,18 +39,35 @@ final class WebHookAlertNotifyHandlerImpl extends
AbstractAlertNotifyHandlerImpl
@Override
public void send(NoticeReceiver receiver, NoticeTemplate noticeTemplate,
GroupAlert alert) {
try {
+ String hookUrl = receiver.getHookUrl();
+
+ // Validate URL completeness and add debug logging
+ if (hookUrl == null || hookUrl.trim().isEmpty()) {
+ throw new AlertNoticeException("Webhook URL is null or empty");
+ }
+
+ // Check if URL is truncated (missing required query parameters)
+ if (hookUrl.contains("logic.azure.cn") &&
!hookUrl.contains("sig=")) {
+ log.warn("Webhook URL appears to be truncated. Original URL
might have been longer than 300 characters. URL: {}", hookUrl);
Review Comment:
For reference only, it seems that it is necessary to determine whether the
URL has been truncated. Determine whether the URL contains the "sig=" substring
to verify its integrity. Is the logic reasonable?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]