zmt-Eason commented on a change in pull request #759:
URL:
https://github.com/apache/incubator-eventmesh/pull/759#discussion_r801189050
##########
File path:
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SubscribeProcessor.java
##########
@@ -148,6 +148,28 @@ public void processRequest(ChannelHandlerContext ctx,
AsyncContext<HttpCommand>
String url = subscribeRequestBody.getUrl();
String consumerGroup = subscribeRequestBody.getConsumerGroup();
+ // validate URL
+ try {
+ if (!IPUtils.isValidDomainOrIp(url,
eventMeshHTTPServer.getEventMeshHttpConfiguration().eventMeshIpv4BlackList,
+
eventMeshHTTPServer.getEventMeshHttpConfiguration().eventMeshIpv6BlackList)) {
+ responseEventMeshCommand = request.createHttpCommandResponse(
+ subscribeResponseHeader,
+ SubscribeResponseBody
+
.buildBody(EventMeshRetCode.EVENTMESH_PROTOCOL_BODY_ERR.getRetCode(),
+
EventMeshRetCode.EVENTMESH_PROTOCOL_BODY_ERR.getErrMsg() + " invalid URL: " +
url));
+ asyncContext.onComplete(responseEventMeshCommand);
+ return;
+ }
+ } catch (Exception e) {
+ responseEventMeshCommand = request.createHttpCommandResponse(
+ subscribeResponseHeader,
+ SubscribeResponseBody
+
.buildBody(EventMeshRetCode.EVENTMESH_PROTOCOL_BODY_ERR.getRetCode(),
+
EventMeshRetCode.EVENTMESH_PROTOCOL_BODY_ERR.getErrMsg() + " invalid URL: " +
url));
+ asyncContext.onComplete(responseEventMeshCommand);
Review comment:
这里可以打印下日志,记录下异常信息
--
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]