Repository navigation
Refuse an incomplete full update of a network ACL rule, and keep an ICMP type given with another protocol - #14643
bhouse-nexthop wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #14643 +/- ##
============================================
+ Coverage 16.45% 16.47% +0.01%
- Complexity 13710 13718 +8
============================================
Files 5669 5669
Lines 501734 501741 +7
Branches 60961 60963 +2
============================================
+ Hits 82584 82638 +54
+ Misses 409895 409846 -49
- Partials 9255 9257 +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:
|
Test report: full updates of a network ACL ruleSummary: an incomplete Environment
Results
Refusal messages Nothing is written by a refused call. The rule's row and CIDRs (
Complete full updates
Result: pass. Not covered
|
|
same here @bhouse-nexthop , is it worth your trouble to rebase on 4.20? |
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 <bhouse@nexthop.ai>
59c4500 to
a536057
Compare
|
@DaanHoogland no trouble. It's rebased onto 4.20 and the PR now targets 4.20 (a536057). The commit applied cleanly, and |
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20017 |
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.