diff --git a/src/main/kotlin/net/bytedance/security/app/RuleData.kt b/src/main/kotlin/net/bytedance/security/app/RuleData.kt index f12115d..b78773b 100644 --- a/src/main/kotlin/net/bytedance/security/app/RuleData.kt +++ b/src/main/kotlin/net/bytedance/security/app/RuleData.kt @@ -91,7 +91,8 @@ data class RuleData( val printCG: Boolean? = null, val IntentSerialTaintsAll: Boolean? = null, - val sanitize: Map>? = null, + var sanitizer: Map>? = null, // new rules + var sanitize: Map>? = null, // old rules val ManifestCheckMode: Boolean? = null, val APIMode: Boolean? = null, diff --git a/src/main/kotlin/net/bytedance/security/app/rules/Rules.kt b/src/main/kotlin/net/bytedance/security/app/rules/Rules.kt index 24941a7..09dee56 100644 --- a/src/main/kotlin/net/bytedance/security/app/rules/Rules.kt +++ b/src/main/kotlin/net/bytedance/security/app/rules/Rules.kt @@ -36,6 +36,10 @@ class Rules(val rulePaths: List, val factory: IRuleFactory) : IRulesForC val rules = Json.parseToJsonElement(jsonStr) for ((ruleName, ruleBody) in rules.jsonObject) { val ruleData: RuleData = Json.decodeFromJsonElement(ruleBody) + if (ruleData.sanitizer != null) { // Compatible with old and new rules + ruleData.sanitize = ruleData.sanitizer + ruleData.sanitizer = null + } val rule = factory.create(ruleName, ruleData) allRules.add(rule) }