dockerzhang commented on code in PR #5225:
URL: https://github.com/apache/inlong/pull/5225#discussion_r933377791


##########
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/master/web/MasterStatusCheckFilter.java:
##########
@@ -65,7 +69,10 @@ public void doFilter(ServletRequest request,
             if (TStringUtils.isNotBlank(req.getQueryString())) {
                 sBuilder.append("?").append(req.getQueryString());
             }
-            resp.sendRedirect(sBuilder.toString());
+            this.redirectWhiteList = sBuilder.toString();
+            if (redirectWhiteList.equals(sBuilder.toString())) {

Review Comment:
   refer to the following example
   ```
   public class UrlRedirect extends HttpServlet {
        private static final String VALID_REDIRECT = 
"http://cwe.mitre.org/data/definitions/601.html";;
   
        protected void doGet(HttpServletRequest request, HttpServletResponse 
response)
        throws ServletException, IOException {
                // BAD: a request parameter is incorporated without validation 
into a URL redirect
                response.sendRedirect(request.getParameter("target"));
   
                // GOOD: the request parameter is validated against a known 
fixed string
                if (VALID_REDIRECT.equals(request.getParameter("target"))) {
                        response.sendRedirect(VALID_REDIRECT);
                }
        }
   }
   ```
   I think it's better to add an expected URL rule to match the 
`sBuilder.toString()` to prevent unexpected values.



-- 
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]

Reply via email to