diff --git a/.changelog/1089.txt b/.changelog/1089.txt new file mode 100644 index 00000000000..f0f86c220db --- /dev/null +++ b/.changelog/1089.txt @@ -0,0 +1,3 @@ +```release-note:bug +user-agent-blocking-rules: add missing managed_challenge validation and removed the deprecated whitelist one +``` \ No newline at end of file diff --git a/user_agent.go b/user_agent.go index 9e33ded4ad4..0c021424fc4 100644 --- a/user_agent.go +++ b/user_agent.go @@ -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)