敏感信息规则 保存
更新时间:2026-03-10
POST
http://iapi.baidu-int.com/v1/waf/desensitizeRules/save
敏感信息规则 保存
请求参数
Headers 参数
除公共头域外,无其它特殊头域
Body 参数
ruleName
string
必选
bindInfo
array
可选
显示子属性
隐藏子属性
items
object {2}
显示子属性
隐藏子属性
instanceID
string
必选
subdomains
array
必选
显示子属性
隐藏子属性
items
string
ruleKey
string
编辑时必传
可选
action
string
log => 观察,deny => 拦截, cover=>打码
必选
ruleType
string
saas
必选
targets
array
必选
显示子属性
隐藏子属性
items
object {3}
显示子属性
隐藏子属性
key
string
必选
match
string
prefix-match:前缀匹配|eq:等于。可选值: prefix-match, eq
必选
value
string
必选
matchType
string
resInfo 敏感信息 resCode 响应码。可选值: resInfo, resCode
必选
matchSubType
array
敏感信息: bank_card:银行卡 | id_card:身份证 | phone:手机号 | resKeyword:敏感关键字; 响应码:400、401、402、403、404、500、501、502、503、504、405-499、505-599
必选
显示子属性
隐藏子属性
items
string
可选值: bank_card, id_card, phone, resKeyword, 400, 401, 402, 403, 404, 500, 501, 502, 503, 504, 405-499, 505-599
matchValue
string
可选
请求结构
{
"ruleName": "规则名称",
"bindInfo": [
{
"instanceID": "string",
"subdomains": [
"string"
]
}
],
"ruleKey": "规则唯一标识",
"action": "log",
"ruleType": "saas",
"targets": [
{
"match": "prefix-match",
"key": "URI",
"value": "匹配内容"
}
],
"matchType": "resInfo",
"matchSubType": [
"bank_card"
],
"matchValue": "匹配内容"
}
示例代码
保存敏感信息规则
curl -X POST "http://iapi.baidu-int.com/v1/waf/desensitizeRules/save" \
-H "Content-Type: application/json" \
-d '{
"ruleName": "示例规则",
"bindInfo": [
{
"instanceID": "inst-123",
"subdomains": [
"www.example.com"
]
}
],
"action": "log",
"ruleType": "saas",
"targets": [
{
"match": "eq",
"key": "URI",
"value": "/api/test"
}
],
"matchType": "resInfo",
"matchSubType": [
"id_card"
],
"matchValue": "敏感数据"
}'
{
"ruleName": "示例规则",
"bindInfo": [
{
"instanceID": "inst-123",
"subdomains": [
"www.example.com"
]
}
],
"action": "log",
"ruleType": "saas",
"targets": [
{
"match": "eq",
"key": "URI",
"value": "/api/test"
}
],
"matchType": "resInfo",
"matchSubType": [
"id_card"
],
"matchValue": "敏感数据"
}
返回响应
Headers 参数
除公共头域外,无其它特殊头域
返回参数
success
boolean
必选
result
object {1}
必选
显示子属性
隐藏子属性
ruleKey
string
必选
返回保存成功的规则标识
成功响应
{
"success": true,
"result": {
"ruleKey": "rule-uuid-1234"
}
}
