wizardzhang commented on code in PR #4572:
URL: https://github.com/apache/eventmesh/pull/4572#discussion_r1402839817
##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/WebhookUtil.java:
##########
@@ -49,12 +50,21 @@ public class WebhookUtil {
private static final Map<String, AuthService> AUTH_SERVICES_MAP = new
ConcurrentHashMap<>();
+ private static final String[] ALLOWED_SCHEMES = new String[]{"http",
"https"};
+
+ private static final UrlValidator URL_VALIDATOR = new
UrlValidator(ALLOWED_SCHEMES);
+
public static boolean obtainDeliveryAgreement(final CloseableHttpClient
httpClient,
final String targetUrl,
final String requestOrigin) {
LogUtils.info(log, "obtain webhook delivery agreement for url: {}",
targetUrl);
+ if (isInvalidUrl(targetUrl)) {
+ LogUtils.info(log, "Target url is invalid url: {}", targetUrl);
Review Comment:
> `LogUtils.error()` may be better.
should i create a new PR or update this PR to correct log level? @pandaapo
##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/WebhookUtil.java:
##########
@@ -49,12 +50,21 @@ public class WebhookUtil {
private static final Map<String, AuthService> AUTH_SERVICES_MAP = new
ConcurrentHashMap<>();
+ private static final String[] ALLOWED_SCHEMES = new String[]{"http",
"https"};
+
+ private static final UrlValidator URL_VALIDATOR = new
UrlValidator(ALLOWED_SCHEMES);
+
public static boolean obtainDeliveryAgreement(final CloseableHttpClient
httpClient,
final String targetUrl,
final String requestOrigin) {
LogUtils.info(log, "obtain webhook delivery agreement for url: {}",
targetUrl);
+ if (isInvalidUrl(targetUrl)) {
+ LogUtils.info(log, "Target url is invalid url: {}", targetUrl);
Review Comment:
> `LogUtils.error()` may be better.
should i create a new PR or update this PR to correct log level? @pandaapo
--
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]