{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"这篇解决什么问题"}]},{"type":"text","value":"：用自己写的规则识别自己的编号（员工号、项目代号、内部工单格式），作用于整个账户或单把 key，保存前先拿样本文本试扫。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"自定义规则由一组固定的部件拼成：一种匹配方式，加上可选的校验位和可选的语境词。部件和上限只在一处定义，"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"GET /v1/dlp/capabilities"}]},{"type":"text","value":"；控制台表单、API 和这篇文档都以它为准。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"自定义规则只在这次调用开着数据保护时生效（见 "},{"type":"element","tagName":"a","properties":{"href":"security"},"children":[{"type":"text","value":"数据保护（DLP）"}]},{"type":"text","value":"）。它叠加在内置类型和推荐规则之上，不替换它们。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"作用范围"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"table","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"thead","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"范围"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"作用于"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"上限"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TENANT"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"账户的每一次调用，包括直连 "},{"type":"element","tagName":"a","properties":{"href":"local-nodes"},"children":[{"type":"text","value":"本地节点"}]},{"type":"text","value":" 的调用"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"50 条"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"KEY"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"只作用于这把 key 的调用，key 必须属于你的账户"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"每把 key 20 条"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"两层规则在同一把 key 的调用上一起生效。范围在创建时确定，之后不能改。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"控制台："},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Security"}]},{"type":"text","value":" → "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Custom rules"}]},{"type":"text","value":"。顶部的选择器在整个账户和某一把 key 之间切换。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"匹配方式"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"table","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"thead","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"kind"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"字段"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"说明"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"KEYWORDS"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"keywords.words"}]},{"type":"text","value":"（最多 100 个，每个最长 64 字符）、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"keywords.wholeWord"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"始终不区分大小写。开 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"wholeWord"}]},{"type":"text","value":" 时，"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"Apollo"}]},{"type":"text","value":" 不会匹配 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"Apollos"}]},{"type":"text","value":" 里的那一段"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"FORMAT"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"format.prefix"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"format.charset"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"format.length.min"}]},{"type":"text","value":"/"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"max"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"format.boundary"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"format.suffix"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"前缀 + 一种字符集 + 有界长度。前缀、后缀最长 32 字符，长度最大 512，前缀加最短长度至少 6"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"REGEX"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"regex"}]},{"type":"text","value":"（最长 500 字符）"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Java 正则语法"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"charset"}]},{"type":"text","value":" 取 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"ALNUM"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"UPPER_DIGIT"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"LOWER_DIGIT"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"HEX"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"DIGITS"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"B64URL"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"B64"}]},{"type":"text","value":" 之一。"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"boundary"}]},{"type":"text","value":" 取 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"WORD"}]},{"type":"text","value":"（命中两侧不能紧挨字母、数字、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"_"}]},{"type":"text","value":" 或 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"-"}]},{"type":"text","value":"）或 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"NONE"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"正则在保存时校验：必须能编译、不能匹配空串、在长文本上要足够快。以 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":".*"}]},{"type":"text","value":" 开头、或嵌套重复如 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"(a+)+"}]},{"type":"text","value":" 的写法会被拒绝并给出原因。扫描时一条规则用完时间预算，这次调用按失败处理，不会放行。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"关键词和格式编译出来的模式是线性时间的，能用它们表达时优先用它们，不必手写正则。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"校验位"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"checksum"}]},{"type":"text","value":" 只保留数字部分通过校验的命中。校验时忽略分隔符（空格和 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"-"}]},{"type":"text","value":"）。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"table","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"thead","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"名称"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"校验"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"LUHN"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Luhn mod 10（银行卡号）"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"IBAN_MOD97"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"IBAN mod 97"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"CN_RESIDENT_ID"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"中国居民身份证，GB 11643"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TW_NATIONAL_ID"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"台湾身分证字号"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TW_RESIDENT_CERT"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"台湾居留证统一证号（新旧两种格式）"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"TW_UBN"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"台湾统一编号"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"语境词"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"context"}]},{"type":"text","value":" 只保留前后 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"window"}]},{"type":"text","value":" 个字符内出现了其中某个词的命中。最多 20 个词，每个最长 32 字符，"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"window"}]},{"type":"text","value":" 取 1～200（默认 40）。比较时不区分大小写。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"适合裸数字：8 位数字到处都是，「会员编号」后面 20 个字符内的 8 位数字就不是了。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"动作"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"action"}]},{"type":"text","value":" 取 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"MASK"}]},{"type":"text","value":"（替换成占位符后继续）、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"BLOCK"}]},{"type":"text","value":"（调用失败、不计费）或 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"ALERT"}]},{"type":"text","value":"（原样转发、记录并通知）。结果与内置类型相同，见 "},{"type":"element","tagName":"a","properties":{"href":"security"},"children":[{"type":"text","value":"数据保护（DLP）"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"规则结构"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-json"]},"children":[{"type":"text","value":"{\n  \"id\": 12,\n  \"scope\": \"TENANT\",\n  \"keyId\": null,\n  \"name\": \"Member number\",\n  \"kind\": \"REGEX\",\n  \"regex\": \"\\\\b\\\\d{8}\\\\b\",\n  \"keywords\": null,\n  \"format\": null,\n  \"checksum\": null,\n  \"context\": { \"words\": [\"member no\", \"會員編號\"], \"window\": 20 },\n  \"action\": \"MASK\",\n  \"enabled\": true,\n  \"description\": \"Loyalty programme\",\n  \"updatedAt\": \"2026-11-20T14:02:11\"\n}\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"只有规则所属 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"kind"}]},{"type":"text","value":" 的那组字段有值。"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"name"}]},{"type":"text","value":" 最长 64 字符，在同一范围内唯一；"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"description"}]},{"type":"text","value":" 最长 255 字符。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"规则拦截一次调用时，返回给调用方的错误只写 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"CUSTOM_RULE"}]},{"type":"text","value":"，不带规则名，你起的规则名不会传到发起调用的应用那里。试扫和控制台里显示规则名。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"接口"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"控制台会话："},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/dlp/..."}]},{"type":"text","value":"。"},{"type":"element","tagName":"a","properties":{"href":"management-key"},"children":[{"type":"text","value":"管理钥"}]},{"type":"text","value":"：同样的路径挂在 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/manage/dlp/..."}]},{"type":"text","value":" 下。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"table","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"thead","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"方法"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"路径"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"作用"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"GET"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/dlp/capabilities"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"上面这些部件、名称和上限"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"GET"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/dlp/rules?scope=TENANT"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"账户级规则。"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"scope=KEY&keyId=N"}]},{"type":"text","value":" 取某把 key 的，"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"scope=ALL"}]},{"type":"text","value":" 两层都取"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"POST"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/dlp/rules"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"新建。请求体："},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"scope"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"keyId"}]},{"type":"text","value":"（"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"KEY"}]},{"type":"text","value":" 时）和规则字段"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"PUT"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/dlp/rules/{id}"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"修改。传了的字段覆盖原值；"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"scope"}]},{"type":"text","value":" 和 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"keyId"}]},{"type":"text","value":" 不能改"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"DELETE"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/dlp/rules/{id}"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"删除"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"POST"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/dlp/rules/test"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"试扫，不保存任何东西"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"试扫接收 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"text"}]},{"type":"text","value":"（最长 20,000 字符）。带 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"rule"}]},{"type":"text","value":" 时只跑这一条草稿；不带时跑 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"keyId"}]},{"type":"text","value":"（或整个账户）当前生效的全部检测：内置类型、推荐规则和已保存的自定义规则。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"curl -X POST https://tare.jamerly.ai/v1/dlp/rules/test \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"text\": \"Refund for member no 40271536, order 99812733\",\n    \"rule\": {\n      \"name\": \"Member number\",\n      \"kind\": \"REGEX\",\n      \"regex\": \"\\\\b\\\\d{8}\\\\b\",\n      \"context\": { \"words\": [\"member no\"], \"window\": 20 },\n      \"action\": \"MASK\"\n    }\n  }'\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-json"]},"children":[{"type":"text","value":"{\n  \"code\": 200,\n  \"data\": {\n    \"hits\": [{ \"label\": \"CUSTOM:Member number\", \"action\": \"MASK\", \"start\": 21, \"end\": 29, \"matched\": \"40271536\" }],\n    \"blocked\": false,\n    \"blockedLabel\": null,\n    \"maskedText\": \"Refund for member no [CUSTOM_REDACTED], order 99812733\"\n  }\n}\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"更多例子"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"项目代号，只认整词："}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-json"]},"children":[{"type":"text","value":"{ \"scope\": \"TENANT\", \"name\": \"Project names\", \"kind\": \"KEYWORDS\",\n  \"keywords\": { \"words\": [\"Apollo\", \"Gemini\", \"Artemis\"], \"wholeWord\": true }, \"action\": \"MASK\" }\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"某把 key 上的内部令牌格式，直接拦截："}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-json"]},"children":[{"type":"text","value":"{ \"scope\": \"KEY\", \"keyId\": 314, \"name\": \"Internal token\", \"kind\": \"FORMAT\",\n  \"format\": { \"prefix\": \"itk_\", \"charset\": \"B64URL\", \"length\": { \"min\": 32, \"max\": 40 }, \"boundary\": \"WORD\", \"suffix\": null },\n  \"action\": \"BLOCK\" }\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"只认「card」附近、通过 Luhn 校验的卡号，只报警："}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-json"]},"children":[{"type":"text","value":"{ \"scope\": \"TENANT\", \"name\": \"Card near label\", \"kind\": \"REGEX\", \"regex\": \"\\\\b(?:\\\\d[ -]?){15}\\\\d\\\\b\",\n  \"checksum\": \"LUHN\", \"context\": { \"words\": [\"card\"], \"window\": 30 }, \"action\": \"ALERT\" }\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"在本地节点上"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"账户级规则同样作用于直连 "},{"type":"element","tagName":"a","properties":{"href":"local-nodes"},"children":[{"type":"text","value":"本地节点"}]},{"type":"text","value":" 的调用，由节点的 DLP sidecar 执行。自定义规则支持校验位和语境词之前的 sidecar，对这类规则只执行模式部分，命中可能比 Tare 上同一条规则多。把 sidecar 更新到当前版本，两条路径的结果就一致。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"下一步"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"内置类型以及各层设置的优先级：读 "},{"type":"element","tagName":"a","properties":{"href":"security"},"children":[{"type":"text","value":"数据保护（DLP）"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"在自己的产品里管理规则：读 "},{"type":"element","tagName":"a","properties":{"href":"management-key"},"children":[{"type":"text","value":"管理钥"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"ALERT"}]},{"type":"text","value":" 命中时收到通知：读 "},{"type":"element","tagName":"a","properties":{"href":"alerts"},"children":[{"type":"text","value":"告警"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"}]}]}