Skip to content

Commit

Permalink
Make error if remap ACL has more than one @action (#11911)
Browse files Browse the repository at this point in the history
  • Loading branch information
masaori335 authored Dec 16, 2024
1 parent 4f1a8bd commit a69662c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/proxy/http/remap/RemapConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ remap_validate_filter_args(acl_filter_rule **rule_pp, const char **argv, int arg
Dbg(dbg_ctl_url_rewrite, "[validate_filter_args] new acl_filter_rule class was created during remap rule processing");
}

bool action_flag = false;
bool ip_is_listed = false;
for (i = 0; i < argc; i++) {
unsigned long ul;
Expand Down Expand Up @@ -632,6 +633,13 @@ remap_validate_filter_args(acl_filter_rule **rule_pp, const char **argv, int arg
}

if (ul & REMAP_OPTFLG_ACTION) { /* "action=" option */
if (action_flag) {
std::string_view err = "Only one @action= is allowed per remap ACL";
Dbg(dbg_ctl_url_rewrite, "%s", err.data());
snprintf(errStrBuf, errStrBufSize, "%s", err.data());
return errStrBuf;
}
action_flag = true;
if (behavior_policy == ACLBehaviorPolicy::ACL_BEHAVIOR_MODERN) {
// With the new matching policy, we don't allow the legacy "allow" and
// "deny" actions. Users must transition to either add_allow/add_deny or
Expand Down

0 comments on commit a69662c

Please sign in to comment.