Skip to content

BUG/MINOR: annotations: skip empty elements in allow-list and deny-list - #849

Open
locker95 wants to merge 1 commit into
haproxytech:masterfrom
locker95:fix-accesslist-empty-elements
Open

BUG/MINOR: annotations: skip empty elements in allow-list and deny-list#849
locker95 wants to merge 1 commit into
haproxytech:masterfrom
locker95:fix-accesslist-empty-elements

Conversation

@locker95

@locker95 locker95 commented Sep 1, 2026

Copy link
Copy Markdown

A trailing comma in the allow-list annotation, e.g. haproxy.org/allow-list: "10.0.0.0/16,", makes strings.Split produce an empty element. net.ParseCIDR("") then fails and the whole annotation is discarded with incorrect address '' in allow-list annotation, so the ingress silently ends up open to all traffic instead of being restricted. The same applies to deny-list and the deprecated whitelist/blacklist names.

This patch skips elements that are empty after trimming, so trailing commas, consecutive commas or stray whitespace no longer invalidate the list. A value with no valid element at all is still rejected as before: adding the rule with an empty map would flip an allow-list into denying everyone, which is just as surprising as allowing everyone.

Added a table-driven test for AccessControl.Process covering trailing/consecutive commas, whitespace-only elements, the deprecated whitelist name, deny-list, pattern files and the existing error paths.

Fixes #848

A trailing comma in an allow-list annotation makes strings.Split
produce an empty element, net.ParseCIDR("") fails and the whole
annotation is discarded, leaving the ingress open to all traffic.
Skip elements that are empty after trimming instead. A value with no
valid element at all is still rejected: adding the rule with an empty
map would flip an allow-list into denying everyone.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trailing comma in haproxy.org/allow-list results in access being allowed from anywhere

1 participant