chore: import verified syly2 maintenance baseline without embedded credentials

This commit is contained in:
Ethan
2026-10-29 22:22:49 +08:00
commit da8224efd8
5265 changed files with 1199963 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
package uat;
import java.io.IOException;
import java.util.Locale;
import javax.servlet.*;
import javax.servlet.http.*;
/** Deployment-only boundary for the isolated restored UAT copy. */
public class UatGuardFilter implements Filter {
public void init(FilterConfig config) {}
public void destroy() {}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
String path = req.getServletPath().toLowerCase(Locale.ROOT);
res.setHeader("X-Syly-Environment", "isolated-uat");
res.setHeader("X-Content-Type-Options", "nosniff");
if (path.contains("appservice") || path.contains("repaircontroller") || path.contains("dataupdatecontroller")
|| path.contains("druid") || path.equals("/rest") || path.startsWith("/rest/") || path.contains("connector.java")
|| path.contains("filesuploadcontroller") || path.contains("/ueditor/jsp/")
|| (path.contains("usercontroller") && req.getParameterMap().containsKey("savenewpwdforuser"))) {
res.sendError(403, "Disabled in isolated UAT"); return;
}
boolean login = path.equals("/logincontroller.do") || path.equals("/logincontroller.action");
if (login && req.getParameterMap().containsKey("checkuser")
&& !"uat_admin".equals(req.getParameter("userName"))) {
res.setContentType("application/json;charset=UTF-8");
res.getWriter().write("{\"success\":false,\"msg\":\"UAT permits only the dedicated test account\"}"); return;
}
boolean publicPath = (login && (req.getParameterMap().containsKey("login") || req.getParameterMap().containsKey("checkuser")))
|| path.equals("/randcodeimage") || path.equals("/") || path.equals("")
|| path.equals("/webpage/login/login.jsp")
|| ((path.startsWith("/plug-in/") || path.startsWith("/style/") || path.startsWith("/images/") || path.startsWith("/css/") || path.startsWith("/js/"))
&& path.matches(".*\\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|swf|map)$"));
if (!publicPath) {
HttpSession session = req.getSession(false);
com.zzc.web.system.pojo.base.Client client = session == null ? null :
com.zzc.web.system.manager.ClientManager.getInstance().getClient(session.getId());
if (client == null || client.getUser() == null || !"uat_admin".equals(client.getUser().getUserName())) {
res.sendError(401, "UAT login required"); return;
}
}
chain.doFilter(request, response);
}
}