diff --git a/src/modules/core/checkIllegalStrings/checkIllegalStrings.ts b/src/modules/core/checkIllegalStrings/checkIllegalStrings.ts index 696d8fb..ddc4f99 100644 --- a/src/modules/core/checkIllegalStrings/checkIllegalStrings.ts +++ b/src/modules/core/checkIllegalStrings/checkIllegalStrings.ts @@ -18,19 +18,27 @@ export const CHECK_CORRECT: CheckResult = { export function checkIllegalStrings(value: string): CheckResult { // 后端传入的校验开关,如果没传,那也默认开启 const enabled = Dec.system.enableParameterVerify ?? true; + let result = CHECK_CORRECT; if (enabled) { - const illegalStringIndex = ILLEGAL_STRINGS.findIndex(s => value.includes(s)); - if (illegalStringIndex === -1) { - return CHECK_CORRECT; - } + // 关键字不区分大小写 + ILLEGAL_STRINGS.every(s => { + const sIndex = value.toLowerCase().indexOf(s); + if (sIndex !== -1) { + result = { + legal: false, + errorMsg: `${BI.i18nText("Dec-Basic_Check_Illegal_Strings")}${value.substr(sIndex, s.length)}`, + }; - return { - legal: false, - errorMsg: `${BI.i18nText("Dec-Basic_Check_Illegal_Strings")}${ILLEGAL_STRINGS[illegalStringIndex]}`, - }; + return false; + } + + return true; + }); + + return result; } - return CHECK_CORRECT; + return result; } export function checkIllegalStringsInWidgetAndShowError(widget: any) { diff --git a/src/modules/core/checkIllegalStrings/constant.ts b/src/modules/core/checkIllegalStrings/constant.ts index a034a3f..351c185 100644 --- a/src/modules/core/checkIllegalStrings/constant.ts +++ b/src/modules/core/checkIllegalStrings/constant.ts @@ -1,5 +1,5 @@ /** - * 参数检验的非法字符数组 + * 参数检验的非法字符数组,由于不区分大小写,统一用小写 */ export const ILLEGAL_STRINGS = [ "\"", @@ -9,7 +9,7 @@ export const ILLEGAL_STRINGS = [ "/script", "javascript:", "onblur", - "getRuntime", - "ProcessBuilder", - "java.lang.ProcessImpl", + "getruntime", + "processbuilder", + "java.lang.processimpl", ];