增加默认值

This commit is contained in:
thinkgem
2025-02-07 20:44:16 +08:00
parent 8b54a7c0e8
commit 1b32b7700a
2 changed files with 6 additions and 4 deletions

View File

@@ -266,7 +266,7 @@ public class EncodeUtils {
"(?:')|(?:--)|(/\\*(?:.|[\\n\\r])*?\\*/)|((extractvalue|updatexml|if|mid|database|rand|user)([\\s]*?)\\()" "(?:')|(?:--)|(/\\*(?:.|[\\n\\r])*?\\*/)|((extractvalue|updatexml|if|mid|database|rand|user)([\\s]*?)\\()"
+ "|(\\b(select|update|and|or|delete|insert|trancate|substr|ascii|declare|exec|count|master|into" + "|(\\b(select|update|and|or|delete|insert|trancate|substr|ascii|declare|exec|count|master|into"
+ "|drop|execute|case when|sleep|union|load_file)\\b)", Pattern.CASE_INSENSITIVE); + "|drop|execute|case when|sleep|union|load_file)\\b)", Pattern.CASE_INSENSITIVE);
private static final Pattern orderByPattern = Pattern.compile("[a-z0-9_\\.\\, ]*", Pattern.CASE_INSENSITIVE); private static final Pattern simplePattern = Pattern.compile("[a-z0-9_\\.\\, ]*", Pattern.CASE_INSENSITIVE);
/** /**
* SQL过滤防止注入传入参数输入有select相关代码替换空。 * SQL过滤防止注入传入参数输入有select相关代码替换空。
@@ -283,8 +283,8 @@ public class EncodeUtils {
public static String sqlFilter(String text, String source){ public static String sqlFilter(String text, String source){
if (text != null){ if (text != null){
String value = text; String value = text;
if ("orderBy".equals(source)) { if ("simple".equals(source) || "orderBy".equals(source)) {
Matcher matcher = orderByPattern.matcher(value); Matcher matcher = simplePattern.matcher(value);
if (!matcher.matches()) { if (!matcher.matches()) {
value = StringUtils.EMPTY; value = StringUtils.EMPTY;
} }

View File

@@ -56,7 +56,9 @@
<% if(@Global.getConfigToBoolean('user.loginCodeCorpUnique', 'false')){ %> <% if(@Global.getConfigToBoolean('user.loginCodeCorpUnique', 'false')){ %>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<#form:treeselect id="switchCorpSelect" title="${text('登录租户')}" allowClear="false" <#form:treeselect id="switchCorpSelect" title="${text('登录租户')}" allowClear="false"
name="param_corpCode" url="${ctxAdmin}/sys/corpAdmin/treeData?isShowCode=true" placeholder="${text('登录租户')}"/> name="param_corpCode" value="${@CorpUtils.getCurrentCorpCode()}"
labelValue="(${@CorpUtils.getCurrentCorpCode()}) ${@CorpUtils.getCurrentCorpName()}"
url="${ctxAdmin}/sys/corpAdmin/treeData?isShowCode=true" placeholder="${text('登录租户')}"/>
</div> </div>
<% } %> <% } %>
<div class="form-group has-feedback" id="isValidCodeLogin" style="display:${isValidCodeLogin?'blank':'none'}"> <div class="form-group has-feedback" id="isValidCodeLogin" style="display:${isValidCodeLogin?'blank':'none'}">