Skip to content

fix(waf): [121984203] Update WAF resource query logic #3141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3141.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/waf: Update WAF resource query logic
```
26 changes: 14 additions & 12 deletions tencentcloud/services/waf/service_tencentcloud_waf.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (me *WafService) DescribeWafCustomRuleById(ctx context.Context, domain, rul
request.Limit = common.Uint64Ptr(20)
request.Filters = []*waf.FiltersItemNew{
{
Name: common.StringPtr("RuleID"),
Name: common.StringPtr("RuleId"),
Values: common.StringPtrs([]string{ruleId}),
ExactMatch: common.BoolPtr(true),
},
Expand Down Expand Up @@ -94,7 +94,7 @@ func (me *WafService) DescribeWafCustomWhiteRuleById(ctx context.Context, domain
request.Limit = common.Uint64Ptr(20)
request.Filters = []*waf.FiltersItemNew{
{
Name: common.StringPtr("RuleID"),
Name: common.StringPtr("RuleId"),
Values: common.StringPtrs([]string{ruleId}),
ExactMatch: common.BoolPtr(true),
},
Expand Down Expand Up @@ -886,7 +886,7 @@ func (me *WafService) DescribeWafAntiFakeById(ctx context.Context, id, domain st
request.Limit = common.Uint64Ptr(10)
request.Filters = []*waf.FiltersItemNew{
{
Name: common.StringPtr("RuleID"),
Name: common.StringPtr("RuleId"),
Values: common.StringPtrs([]string{id}),
ExactMatch: common.BoolPtr(true),
},
Expand Down Expand Up @@ -948,6 +948,15 @@ func (me *WafService) DescribeWafAntiInfoLeakById(ctx context.Context, ruleId, d

request := waf.NewDescribeAntiInfoLeakageRulesRequest()
request.Domain = &domain
request.Limit = common.Uint64Ptr(10)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方写死的?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是查询1个值的方法,这个字段不设置会报错 所以设置默认10

request.Offset = common.Uint64Ptr(0)
request.Filters = []*waf.FiltersItemNew{
{
Name: common.StringPtr("RuleId"),
Values: common.StringPtrs([]string{ruleId}),
ExactMatch: common.BoolPtr(true),
},
}

defer func() {
if errRet != nil {
Expand All @@ -969,14 +978,7 @@ func (me *WafService) DescribeWafAntiInfoLeakById(ctx context.Context, ruleId, d
return
}

ruleIdInt, _ := strconv.ParseUint(ruleId, 10, 64)
for _, item := range response.Response.RuleList {
if *item.RuleId == ruleIdInt {
antiInfoLeak = item
break
}
}

antiInfoLeak = response.Response.RuleList[0]
return
}

Expand Down Expand Up @@ -1189,7 +1191,7 @@ func (me *WafService) DescribeWafCcById(ctx context.Context, domain, ruleId stri
request.Domain = &domain
request.Filters = []*waf.FiltersItemNew{
{
Name: common.StringPtr("RuleID"),
Name: common.StringPtr("RuleId"),
Values: common.StringPtrs([]string{ruleId}),
ExactMatch: common.BoolPtr(true),
},
Expand Down
Loading