Skip to content

Commit

Permalink
Merge pull request #1089 from cloudflare/user-agent-blocking-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz authored Sep 21, 2022
2 parents bb37d69 + 5ff52f2 commit eceec5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/1089.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
user-agent-blocking-rules: add missing managed_challenge validation and removed the deprecated whitelist one
```
4 changes: 2 additions & 2 deletions user_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ type UserAgentRuleListResponse struct {
// API reference: https://api.cloudflare.com/#user-agent-blocking-rules-create-a-useragent-rule
func (api *API) CreateUserAgentRule(ctx context.Context, zoneID string, ld UserAgentRule) (*UserAgentRuleResponse, error) {
switch ld.Mode {
case "block", "challenge", "js_challenge", "whitelist":
case "block", "challenge", "js_challenge", "managed_challenge":
break
default:
return nil, errors.New(`the User-Agent Block rule mode must be one of "block", "challenge", "js_challenge", "whitelist"`)
return nil, errors.New(`the User-Agent Block rule mode must be one of "block", "challenge", "js_challenge", "managed_challenge"`)
}

uri := fmt.Sprintf("/zones/%s/firewall/ua_rules", zoneID)
Expand Down

0 comments on commit eceec5d

Please sign in to comment.