- Added check in access_control_list.py which sets implicit permission to NA if boolean is False
- Changed the defaults in training_config.py so that each scenario has an EXPLICIT ALLOW rule as default implicit rule
- Updated the test_seeding_and_deterministic_session.py because of change no2 adds an extra rule to that scenario
This commit is contained in:
SunilSamra
2023-07-17 10:27:56 +01:00
parent 9df8d132fc
commit 707d8f6189
3 changed files with 21 additions and 17 deletions

View File

@@ -17,12 +17,11 @@ class AccessControlList:
# Bool option in main_config to decide to use implicit rule or not
self.apply_implicit_rule: bool = apply_implicit_rule
# Implicit ALLOW or DENY firewall spec
if self.apply_implicit_rule:
self.acl_implicit_permission = implicit_permission
else:
self.acl_implicit_permission = "NA"
# Last rule in the ACL list
self.acl_implicit_permission = implicit_permission
# Maximum number of ACL Rules in ACL
self.max_acl_rules: int = max_acl_rules
# A list of ACL Rules
self._acl: List[Union[ACLRule, None]] = [None] * (self.max_acl_rules - 1)
# Implicit rule
self.acl_implicit_rule = None
if self.apply_implicit_rule:
@@ -31,6 +30,11 @@ class AccessControlList:
elif self.acl_implicit_permission == RulePermissionType.ALLOW:
self.acl_implicit_rule = ACLRule("ALLOW", "ANY", "ANY", "ANY", "ANY")
# Maximum number of ACL Rules in ACL
self.max_acl_rules: int = max_acl_rules
# A list of ACL Rules
self._acl: List[Union[ACLRule, None]] = [None] * (self.max_acl_rules - 1)
@property
def acl(self):
"""Public access method for private _acl.

View File

@@ -100,10 +100,10 @@ class TrainingConfig:
"Stable Baselines3 learn/eval output verbosity level"
# Access Control List/Rules
apply_implicit_rule: str = False
apply_implicit_rule: str = True
"User choice to have Implicit ALLOW or DENY."
implicit_acl_rule: RulePermissionType = RulePermissionType.DENY
implicit_acl_rule: RulePermissionType = RulePermissionType.ALLOW
"ALLOW or DENY implicit firewall rule to go at the end of list of ACL list."
max_number_acl_rules: int = 30

View File

@@ -26,16 +26,16 @@ def test_seeded_learning(temp_primaite_session):
now work. If not, then you've got a bug :).
"""
expected_mean_reward_per_episode = {
1: -30.703125,
2: -29.94140625,
3: -27.91015625,
4: -29.66796875,
5: -32.44140625,
6: -30.33203125,
7: -26.25,
8: -22.44140625,
9: -30.3125,
10: -28.359375,
1: -90.703125,
2: -91.15234375,
3: -87.5,
4: -92.2265625,
5: -94.6875,
6: -91.19140625,
7: -88.984375,
8: -88.3203125,
9: -112.79296875,
10: -100.01953125,
}
with temp_primaite_session as session: