Repository navigation
Network ACL: validate the protocol name against the list, not as a substring - #14359
Open
bhouse-nexthop wants to merge 2 commits into
Open
bhouse-nexthop wants to merge 2 commits into
bhouse-nexthop wants to merge 2 commits into
Conversation
validateProtocol() checked a protocol name with "tcp,udp,icmp,all".contains(protocol), a substring test, so "cp", "t", "dp,ic", "," or "tcp,udp" were accepted. Such a rule is stored and listed but never applied: the VR side can't parse it and drops it with only a warning. Compare against the entries of the list instead. Fixes: apache#14358 Signed-off-by: Brad House <bhouse@nexthop.ai>
bhouse-nexthop
requested review from
DaanHoogland,
sureshanaparti,
vladimirpetrov and
weizhouapache
October 8, 2026 10:15
Collaborator
Author
|
@vladimirpetrov @sureshanaparti could you take a look at this one? We'd like this fix to make it into the upcoming 4.22.2 release. |
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14359 +/- ##
=============================================
- Coverage 18.02% 4.04% -13.99%
=============================================
Files 5936 449 -5487
Lines 535823 38240 -497583
Branches 65612 7082 -58530
=============================================
- Hits 96582 1546 -95036
+ Misses 428242 36482 -391760
+ Partials 10999 212 -10787
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Brad House <bhouse@nexthop.ai>
This branch has not been deployed
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.
Description
createNetworkACLandupdateNetworkACLItemaccept protocol names that are not valid, such ascp,dp,icortcp,udp. The rule is stored and listed but never applied.Fixes #14358
Why it breaks
NetworkACLServiceImpl.validateProtocol()checked a non-numeric protocol withsupportedProtocolsForAclRules.contains(protocol.toLowerCase()).supportedProtocolsForAclRulesis the string"tcp,udp,icmp,all", so this is a substring test: anything that appears inside it passes.On the VR side,
SetNetworkAclConfigItemdoesn't recognise such a protocol, triesInteger.parseInton it, and drops the rule with only a warning in the agent log. An allow or deny that the API accepted, and that the UI shows, silently does nothing.How it is fixed
The protocol is compared against the entries of the list (
split(",")), case-insensitively as before. The field, the error message and the valid names are unchanged.How to reproduce the old behaviour
createNetworkACL aclid=<id> protocol=cp startport=22 endport=22 cidrlist=0.0.0.0/0 action=deny traffictype=ingresslistNetworkACLsshows the rule with protocolcp. No rule for it appears on the VR, and the agent logs "Problem occurred when reading the entries in the ruleParts array".Invalid protocol [cp]. Expected one of: [tcp,udp,icmp,all].The old and new checks, side by side (jshell):
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
NetworkACLServiceImplTest.validateProtocolTestProtocolIsPartOfTheSupportedListchecks thatcp,t,dp,ic,,andtcp,udpare each rejected.validateProtocolTestProtocolNameInAnyCasechecks that valid names are still accepted in any case (TCP,Udp,ICMP,All). The existing tests for valid names and protocol numbers still pass:NetworkACLServiceImplTest, 106 tests.serverbuilds with checkstyle.How did you try to break this feature and the system with this change?
Locale.ROOT. Under a Turkish default locale the old check rejectedICMP, because it lowercased to a dotlessıcmp; it is now accepted.NetworkACLServiceImpl, in a different method.