Skip to content

Commit 9ccc4d2

Browse files
committed
Fix bug in necessity propagation by not updating necessity on children nodes with non-zero non-unit TTC values
1 parent ae9cbed commit 9ccc4d2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

maltoolbox/attackgraph/analyzers/apriori.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,16 @@ def propagate_necessity_from_node(node: AttackGraphNode) -> None:
5555
node.full_name, node.id, node.is_necessary
5656
)
5757

58-
if node.ttc and 'name' in node.ttc:
59-
if node.ttc['name'] not in ['Enabled', 'Disabled', 'Instant']:
58+
for child in node.children:
59+
if child.ttc and child.ttc.get('name', None) not in ['Enabled',
60+
'Disabled', 'Instant']:
6061
# Do not propagate unnecessary state from nodes that have a TTC
6162
# probability distribution associated with them.
6263
# TODO: Evaluate this more carefully, how do we want to have TTCs
6364
# impact necessity and viability.
6465
# TODO: Have this condition be any probability that has a
6566
# Bernoulli component
66-
return
67-
68-
for child in node.children:
67+
continue
6968
original_value = child.is_necessary
7069
if child.type == 'or':
7170
child.is_necessary = False

0 commit comments

Comments
 (0)