Skip to content

Commit

Permalink
Remove base false positive/negative rates
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkickling committed Oct 14, 2024
1 parent d3742f1 commit cd0e80a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 21 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ observable_attack_steps:
# will be observed as inactive at a rate of x in each observation
# Default false positive/negative rate is 0, which is assumed if none are given.

# A baseline that applies to all attack steps (default 0)
false_positive_base_rate: <rate>
false_negative_base_rate: <rate>

# Applies false positive rates per attack step (default 0)
false_positive_rates:
<attack step full name>: <rate>
Expand Down
9 changes: 0 additions & 9 deletions malsim/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@
'rewards',
'attacker_entry_points',
'observable_attack_steps',
'false_positive_base_rate',
'false_positive_rates',
'false_negative_base_rate',
'false_negative_rates',
]

Expand Down Expand Up @@ -193,13 +191,6 @@ def apply_scenario_false_positive_and_negative_rates(
AttackGraph either to the default value, from the base rate
or from the specifically set rates per attack step"""

# Apply false positive/negative base rates for all nodes (default 0)
fp_baseline = scenario_conf.get('false_positive_base_rate', 0)
fn_baseline = scenario_conf.get('false_negative_base_rate', 0)
for node in attack_graph.nodes:
node.extras['false_positive_rate'] = fp_baseline
node.extras['false_negative_rate'] = fn_baseline

# Apply false positive rates to specified attack nodes
fp_rates_per_attackstep = scenario_conf.get('false_positive_rates')
if fp_rates_per_attackstep:
Expand Down
11 changes: 7 additions & 4 deletions tests/test_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,11 @@ def test_load_scenario_false_positive_negative_rate():
)

# Defined in scenario file
fp_base_rate = 0.1
fn_base_rate = 0.1
host_0_access_fp_rate = 0.2
host_1_access_fp_rate = 0.3
host_0_access_fn_rate = 0.4
host_1_access_fn_rate = 0.5
user_3_compromise_fn_rate = 1.0

for node in attack_graph.nodes:
if node.full_name == "Host:0:access":
Expand All @@ -288,6 +287,10 @@ def test_load_scenario_false_positive_negative_rate():
elif node.full_name == "Host:1:access":
assert node.extras['false_positive_rate'] == host_1_access_fp_rate
assert node.extras['false_negative_rate'] == host_1_access_fn_rate
elif node.full_name == "User:3:compromise":
assert 'false_positive_rate' not in node.extras
assert node.extras['false_negative_rate'] \
== user_3_compromise_fn_rate
else:
assert node.extras['false_positive_rate'] == fp_base_rate
assert node.extras['false_negative_rate'] == fn_base_rate
assert 'false_positive_rate' not in node.extras
assert 'false_negative_rate' not in node.extras
4 changes: 0 additions & 4 deletions tests/testdata/scenarios/traininglang_fp_fn_scenario.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ attacker_entry_points:
attacker_agent_class: 'BreadthFirstAttacker'
defender_agent_class: 'KeyboardAgent'

# Baseline applies to all attack steps
false_positive_base_rate: 0.1
false_negative_base_rate: 0.1

# Specific fpr/fnr for some specific steps
false_positive_rates:
'Host:0:access': 0.2
Expand Down

0 comments on commit cd0e80a

Please sign in to comment.