Repository navigation
Refuse an incomplete full update of a network ACL rule, and keep an ICMP type given with another protocol - #14643
Open
bhouse-nexthop wants to merge 1 commit into
Open
bhouse-nexthop wants to merge 1 commit into
bhouse-nexthop wants to merge 1 commit into
Conversation
updateNetworkACLItem with partialupgrade=false replaces every field of the rule. A call that left out cidrlist or traffictype wrote the rule with those fields null, then failed with an NPE on the null CIDR list. The row was already committed, so listNetworkACLs and the next ACL apply failed on the null traffic type until the rule was fully updated again. A call without protocol failed with an NPE. Refuse a full update without protocol, cidrlist or traffictype before anything is changed. Write the rule and its CIDRs in one transaction, so that a failure on the CIDRs rolls back the rule too. Refuse an invalid traffictype, as createNetworkACL does, instead of ignoring it. A full update to a non-ICMP protocol also dropped an ICMP type or code given with it: protocol=tcp icmptype=8 was accepted and stored as tcp. Keep the given values so that the existing validation refuses them, as it does on create and on a partial update. Signed-off-by: Brad House <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14643 +/- ##
=========================================
Coverage 18.32% 18.32%
- Complexity 16644 16649 +5
=========================================
Files 5939 5939
Lines 537768 537775 +7
Branches 65929 65931 +2
=========================================
+ Hits 98551 98574 +23
+ Misses 428008 427994 -14
+ Partials 11209 11207 -2
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:
|
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
This PR fixes two problems with
updateNetworkACLItemwhenpartialupgrade=false, which replaces every field of the rule.cidrlistortraffictype, the rule was written with those fields null, and then the call failed with an NPE on the null CIDR list. The row had already been committed, solistNetworkACLsand the next ACL apply failed on the null traffic type until the rule was fully updated again. Withoutprotocol, the call failed with an NPE.protocol,cidrlistortraffictypeis now refused before anything is changed: "The protocol, cidrlist and traffictype must be given when the ACL rule is updated with partialupgrade=false".createNetworkACLdoes (0.0.0.0/0,::/0and Ingress). A default would silently open a rule to every address or turn an egress rule into an ingress rule.NetworkACLItemDaoImpl.update()now writes the rule and its CIDRs in one transaction, aspersist()already does. A failure on the CIDRs now rolls back the rule as well.actionis unchanged: when it is left out it is still Allow, as before and as on create.partialupgrade=false protocol=tcp icmptype=8was accepted and stored as tcp. The values are now kept, so the existing check refuses them with "Can specify icmpCode and icmpType for ICMP protocol only", ascreateNetworkACLand a partial update already do. When none is given, changing an ICMP rule to another protocol still clears the ICMP type and code.Behaviour changes to note:
traffictype(for exampleegres) is now refused with "Invalid traffic type egres", as on create. Before, a partial update silently ignored it.traffictypeandpartialupgradeparameter descriptions are updated to match.The UI's edit dialog always sends
protocol,cidrlistandtraffictypewithpartialupgrade=false, so it is not affected.Relation to other open PRs:
icmpin the same command. It is independent of this PR.Fixes: #14642
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
NetworkACLServiceImplTest:icmptype=8is refused byvalidateNetworkACLItem;traffictypeparsing: blank, valid in either case, and invalid.mvn -pl server -am test -Dtest=NetworkACLServiceImplTest,NetworkACLManagerTest: 109 and 8 tests, all pass.How did you try to break this feature and the system with this change?
AclRulesTab.vue). It sends every field, and an emptycidrlistis still accepted as an empty list, as before.NetworkACLItemDaoImpl.update()(rule state changes and revoke). They pass rules loaded with their CIDRs, and the nested transaction commits with the outer one.traffictype.