Skip to content

Commit

Permalink
Merge pull request #52 from firmianay/dev3
Browse files Browse the repository at this point in the history
use 'sanitizer' in new rules
  • Loading branch information
nkbai authored Sep 25, 2023
2 parents 9020296 + eafdbf7 commit 7b9ff87
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/kotlin/net/bytedance/security/app/RuleData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ data class RuleData(
val printCG: Boolean? = null,
val IntentSerialTaintsAll: Boolean? = null,

val sanitize: Map<String, LinkedHashMap<String, JsonElement>>? = null,
var sanitizer: Map<String, LinkedHashMap<String, JsonElement>>? = null, // new rules
var sanitize: Map<String, LinkedHashMap<String, JsonElement>>? = null, // old rules

val ManifestCheckMode: Boolean? = null,
val APIMode: Boolean? = null,
Expand Down
4 changes: 4 additions & 0 deletions src/main/kotlin/net/bytedance/security/app/rules/Rules.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class Rules(val rulePaths: List<String>, 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)
}
Expand Down

0 comments on commit 7b9ff87

Please sign in to comment.