You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spot.apache.org by na...@apache.org on 2018/03/19 19:28:12 UTC

[03/42] incubator-spot git commit: Incorrect assumption inbound/outbound crashes

Incorrect assumption inbound/outbound crashes 

The code assumes that there are always inbound only and outbound only connections. This causes saving a scored threat that has either no inbound, or outbound only connections. Fix is simply moving the column header row to outside the check, so the array element is always initialized before being accessed.

Project: http://git-wip-us.apache.org/repos/asf/incubator-spot/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spot/commit/3baa75aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spot/tree/3baa75aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spot/diff/3baa75aa

Branch: refs/heads/SPOT-181_ODM
Commit: 3baa75aaef6abdeaef3358acf502751cd5dbe919
Parents: 2ebe572
Author: castleguarders <ca...@users.noreply.github.com>
Authored: Tue Sep 26 14:29:14 2017 -0700
Committer: GitHub <no...@github.com>
Committed: Tue Sep 26 14:29:14 2017 -0700

----------------------------------------------------------------------
 spot-oa/api/resources/flow.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spot/blob/3baa75aa/spot-oa/api/resources/flow.py
----------------------------------------------------------------------
diff --git a/spot-oa/api/resources/flow.py b/spot-oa/api/resources/flow.py
index ab5105f..418f87c 100755
--- a/spot-oa/api/resources/flow.py
+++ b/spot-oa/api/resources/flow.py
@@ -492,8 +492,8 @@ def create_incident_progression(anchor, inbound, outbound, twoway, date):
     }
 
     #----- Add Inbound Connections-------#
+    obj["children"].append({'name': 'Inbound Only', 'children': [], 'impact': 0})
     if len(inbound) > 0:
-        obj["children"].append({'name': 'Inbound Only', 'children': [], 'impact': 0})
         in_ctxs = {}
         for ip in inbound:
             if 'nwloc' in inbound[ip] and len(inbound[ip]['nwloc']) > 0:
@@ -509,8 +509,8 @@ def create_incident_progression(anchor, inbound, outbound, twoway, date):
                 })
 
     #------ Add Outbound ----------------#
+    obj["children"].append({'name':'Outbound Only','children':[],'impact':0})
     if len(outbound) > 0:
-        obj["children"].append({'name':'Outbound Only','children':[],'impact':0})
         out_ctxs = {}
         for ip in outbound:
             if 'nwloc' in outbound[ip] and len(outbound[ip]['nwloc']) > 0:
@@ -526,8 +526,8 @@ def create_incident_progression(anchor, inbound, outbound, twoway, date):
                 })
 
     #------ Add TwoWay ----------------#
+    obj["children"].append({'name':'two way','children': [], 'impact': 0})
     if len(twoway) > 0:
-        obj["children"].append({'name':'two way','children': [], 'impact': 0})
         tw_ctxs = {}
         for ip in twoway:
             if 'nwloc' in twoway[ip] and len(twoway[ip]['nwloc']) > 0: