CLEANUP/MINOR: annotations: skip empty elements in allow-list and deny-list - #849
Merged
haproxyci merged 1 commit intoSep 10, 2026
Merged
Conversation
oktalz
reviewed
Sep 3, 2026
Contributor
Author
|
switched the split to FieldsFunc so trailing/double commas drop out. still trim spaces so |
oktalz
force-pushed
the
fix-accesslist-empty-elements
branch
from
September 9, 2026 14:34
0b722a6 to
b52a720
Compare
…y-list
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.
Split the value with strings.FieldsFunc so consecutive or trailing
commas yield no element, and skip elements that are blank after
trimming. 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.
Signed-off-by: Dean Chen <862469039@qq.com>
oktalz
force-pushed
the
fix-accesslist-empty-elements
branch
from
September 9, 2026 14:53
b52a720 to
8506feb
Compare
Member
Contributor
Author
|
yeah that's fine, thanks for fixing it up. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A trailing comma in the allow-list annotation, e.g.
haproxy.org/allow-list: "10.0.0.0/16,", makesstrings.Splitproduce an empty element.net.ParseCIDR("")then fails and the whole annotation is discarded withincorrect 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