DeepTeam is a framework to red team LLMs and AI agents.
format
A-Vamshi3e4fb3152783
diff --git a/deepteam/attacks/attack_simulator/attack_simulator.py b/deepteam/attacks/attack_simulator/attack_simulator.pyindex ac374593..f3b28dfa 100644--- a/deepteam/attacks/attack_simulator/attack_simulator.py+++ b/deepteam/attacks/attack_simulator/attack_simulator.py@@ -207,7 +207,7 @@ class AttackSimulator:try:return vulnerability.simulate_attacks(purpose=self.purpose,- attacks_per_vulnerability_type=attacks_per_vulnerability_type+ attacks_per_vulnerability_type=attacks_per_vulnerability_type,)except Exception as e:if ignore_errors:@@ -234,7 +234,7 @@ class AttackSimulator:try:return await vulnerability.a_simulate_attacks(purpose=self.purpose,- attacks_per_vulnerability_type=attacks_per_vulnerability_type+ attacks_per_vulnerability_type=attacks_per_vulnerability_type,)except Exception as e:if ignore_errors:diff --git a/deepteam/vulnerabilities/shell_injection/shell_injection.py b/deepteam/vulnerabilities/shell_injection/shell_injection.pyindex 9be731d9..437df4ed 100644--- a/deepteam/vulnerabilities/shell_injection/shell_injection.py+++ b/deepteam/vulnerabilities/shell_injection/shell_injection.py@@ -233,7 +233,7 @@ class ShellInjection(BaseVulnerability):self.simulator_model, self.using_native_model = initialize_model(self.simulator_model)-+self.purpose = purposetemplates = dict()diff --git a/tests/test_core/test_vulnerabilities/test_excessive_agency.py b/tests/test_core/test_vulnerabilities/test_excessive_agency.pyindex 88af37a2..1131af0f 100644--- a/tests/test_core/test_vulnerabilities/test_excessive_agency.py+++ b/tests/test_core/test_vulnerabilities/test_excessive_agency.py@@ -10,9 +10,7 @@ class TestExcessiveAgency:def test_excessive_agency_all_types(self):types = ["functionality", "permissions", "autonomy"]- excessive_agency = ExcessiveAgency(- types=types- )+ excessive_agency = ExcessiveAgency(types=types)assert sorted(type.value for type in excessive_agency.types) == sorted(types)@@ -25,27 +23,21 @@ class TestExcessiveAgency:def test_excessive_agency_functionality(self):types = ["functionality"]- excessive_agency = ExcessiveAgency(- types=types- )+ excessive_agency = ExcessiveAgency(types=types)assert sorted(type.value for type in excessive_agency.types) == sorted(types)def test_excessive_agency_permissions(self):types = ["permissions"]- excessive_agency = ExcessiveAgency(- types=types- )+ excessive_agency = ExcessiveAgency(types=types)assert sorted(type.value for type in excessive_agency.types) == sorted(types)def test_excessive_agency_autonomy(self):types = ["autonomy"]- excessive_agency = ExcessiveAgency(- types=types- )+ excessive_agency = ExcessiveAgency(types=types)assert sorted(type.value for type in excessive_agency.types) == sorted(types)diff --git a/tests/test_core/test_vulnerabilities/test_graphic_content.py b/tests/test_core/test_vulnerabilities/test_graphic_content.pyindex 9895c0e9..16250ed1 100644--- a/tests/test_core/test_vulnerabilities/test_graphic_content.py+++ b/tests/test_core/test_vulnerabilities/test_graphic_content.py@@ -8,9 +8,7 @@ class TestGraphicContent:def test_graphic_content_all_types(self):types = ["sexual content", "graphic content", "pornographic content"]- graphic_content = GraphicContent(- types=types- )+ graphic_content = GraphicContent(types=types)assert sorted(type.value for type in graphic_content.types) == sorted(types)@@ -23,27 +21,21 @@ class TestGraphicContent:def test_graphic_content_sexual_content(self):types = ["sexual content"]- graphic_content = GraphicContent(- types=types- )+ graphic_content = GraphicContent(types=types)assert sorted(type.value for type in graphic_content.types) == sorted(types)def test_graphic_content_graphic_content(self):types = ["graphic content"]- graphic_content = GraphicContent(- types=types- )+ graphic_content = GraphicContent(types=types)assert sorted(type.value for type in graphic_content.types) == sorted(types)def test_graphic_content_pornographic_content(self):types = ["pornographic content"]- graphic_content = GraphicContent(- types=types- )+ graphic_content = GraphicContent(types=types)assert sorted(type.value for type in graphic_content.types) == sorted(types)@@ -56,6 +48,4 @@ class TestGraphicContent:"invalid",]with pytest.raises(ValueError):- GraphicContent(- types=types- )+ GraphicContent(types=types)diff --git a/tests/test_core/test_vulnerabilities/test_illegal_activity.py b/tests/test_core/test_vulnerabilities/test_illegal_activity.pyindex a6fd08ea..1ce14eb1 100644--- a/tests/test_core/test_vulnerabilities/test_illegal_activity.py+++ b/tests/test_core/test_vulnerabilities/test_illegal_activity.py@@ -16,9 +16,7 @@ class TestIllegalActivity:"cybercrime","child exploitation",]- illegal_activity = IllegalActivity(- types=types- )+ illegal_activity = IllegalActivity(types=types)assert sorted(type.value for type in illegal_activity.types) == sorted(types)@@ -31,63 +29,49 @@ class TestIllegalActivity:def test_illegal_activity_weapons(self):types = ["weapons"]- illegal_activity = IllegalActivity(- types=types- )+ illegal_activity = IllegalActivity(types=types)assert sorted(type.value for type in illegal_activity.types) == sorted(types)def test_illegal_activity_illegal_drugs(self):types = ["illegal drugs"]- illegal_activity = IllegalActivity(- types=types- )+ illegal_activity = IllegalActivity(types=types)assert sorted(type.value for type in illegal_activity.types) == sorted(types)def test_illegal_activity_violent_crimes(self):types = ["violent crimes"]- illegal_activity = IllegalActivity(- types=types- )+ illegal_activity = IllegalActivity(types=types)assert sorted(type.value for type in illegal_activity.types) == sorted(types)def test_illegal_activity_non_violent_crimes(self):types = ["non violent crimes"]- illegal_activity = IllegalActivity(- types=types- )+ illegal_activity = IllegalActivity(types=types)assert sorted(type.value for type in illegal_activity.types) == sorted(types)def test_illegal_activity_sex_crimes(self):types = ["sex crimes"]- illegal_activity = IllegalActivity(- types=types- )+ illegal_activity = IllegalActivity(types=types)assert sorted(type.value for type in illegal_activity.types) == sorted(types)def test_illegal_activity_cybercrime(self):types = ["cybercrime"]- illegal_activity = IllegalActivity(- types=types- )+ illegal_activity = IllegalActivity(types=types)assert sorted(type.value for type in illegal_activity.types) == sorted(types)def test_illegal_activity_child_exploitation(self):types = ["child exploitation"]- illegal_activity = IllegalActivity(- types=types- )+ illegal_activity = IllegalActivity(types=types)assert sorted(type.value for type in illegal_activity.types) == sorted(types)@@ -104,6 +88,4 @@ class TestIllegalActivity:"invalid",]with pytest.raises(ValueError):- IllegalActivity(- types=types- )+ IllegalActivity(types=types)diff --git a/tests/test_core/test_vulnerabilities/test_intellectual_property.py b/tests/test_core/test_vulnerabilities/test_intellectual_property.pyindex 130b9fca..2c259817 100644--- a/tests/test_core/test_vulnerabilities/test_intellectual_property.py+++ b/tests/test_core/test_vulnerabilities/test_intellectual_property.py@@ -15,9 +15,7 @@ class TestIntellectualProperty:"trademark infringement","patent disclosure",]- intellectual_property = IntellectualProperty(- types=types- )+ intellectual_property = IntellectualProperty(types=types)assert sorted(type.value for type in intellectual_property.types) == sorted(types)@@ -30,36 +28,28 @@ class TestIntellectualProperty:def test_intellectual_property_imitation(self):types = ["imitation"]- intellectual_property = IntellectualProperty(- types=types- )+ intellectual_property = IntellectualProperty(types=types)assert sorted(type.value for type in intellectual_property.types) == sorted(types)def test_intellectual_property_copyright_violations(self):types = ["copyright violations"]- intellectual_property = IntellectualProperty(- types=types- )+ intellectual_property = IntellectualProperty(types=types)assert sorted(type.value for type in intellectual_property.types) == sorted(types)def test_intellectual_property_trademark_infringement(self):types = ["trademark infringement"]- intellectual_property = IntellectualProperty(- types=types- )+ intellectual_property = IntellectualProperty(types=types)assert sorted(type.value for type in intellectual_property.types) == sorted(types)def test_intellectual_property_patent_disclosure(self):types = ["patent disclosure"]- intellectual_property = IntellectualProperty(- types=types- )+ intellectual_property = IntellectualProperty(types=types)assert sorted(type.value for type in intellectual_property.types) == sorted(types)@@ -73,6 +63,4 @@ class TestIntellectualProperty:"invalid",]with pytest.raises(ValueError):- IntellectualProperty(- types=types- )+ IntellectualProperty(types=types)diff --git a/tests/test_core/test_vulnerabilities/test_misinformation.py b/tests/test_core/test_vulnerabilities/test_misinformation.pyindex ba3611cf..ca68350b 100644--- a/tests/test_core/test_vulnerabilities/test_misinformation.py+++ b/tests/test_core/test_vulnerabilities/test_misinformation.py@@ -13,7 +13,6 @@ class TestMisinformation:"expertize misrepresentation",]misinformation = Misinformation(-types=types,)assert sorted(type.value for type in misinformation.types) == sorted(@@ -21,9 +20,7 @@ class TestMisinformation:)def test_misinformation_all_types_default(self):- misinformation = Misinformation(-- )+ misinformation = Misinformation()assert sorted(type.value for type in misinformation.types) == sorted(type.value for type in MisinformationType)@@ -31,7 +28,6 @@ class TestMisinformation:def test_misinformation_factual_errors(self):types = ["factual errors"]misinformation = Misinformation(-types=types,)assert sorted(type.value for type in misinformation.types) == sorted(@@ -41,7 +37,6 @@ class TestMisinformation:def test_misinformation_unsupported_claims(self):types = ["unsupported claims"]misinformation = Misinformation(-types=types,)assert sorted(type.value for type in misinformation.types) == sorted(@@ -51,7 +46,6 @@ class TestMisinformation:def test_misinformation_expertize_misrepresentation(self):types = ["expertize misrepresentation"]misinformation = Misinformation(-types=types,)assert sorted(type.value for type in misinformation.types) == sorted(@@ -67,6 +61,5 @@ class TestMisinformation:]with pytest.raises(ValueError):Misinformation(-types=types,)diff --git a/tests/test_core/test_vulnerabilities/test_personal_safety.py b/tests/test_core/test_vulnerabilities/test_personal_safety.pyindex 86672682..6cec5652 100644--- a/tests/test_core/test_vulnerabilities/test_personal_safety.py+++ b/tests/test_core/test_vulnerabilities/test_personal_safety.py@@ -14,9 +14,7 @@ class TestPersonalSafety:"dangerous challenges","stalking",]- personal_safety = PersonalSafety(- types=types- )+ personal_safety = PersonalSafety(types=types)assert sorted(type.value for type in personal_safety.types) == sorted(types)@@ -29,45 +27,35 @@ class TestPersonalSafety:def test_personal_safety_bullying(self):types = ["bullying"]- personal_safety = PersonalSafety(- types=types- )+ personal_safety = PersonalSafety(types=types)assert sorted(type.value for type in personal_safety.types) == sorted(types)def test_personal_safety_self_harm(self):types = ["self-harm"]- personal_safety = PersonalSafety(- types=types- )+ personal_safety = PersonalSafety(types=types)assert sorted(type.value for type in personal_safety.types) == sorted(types)def test_personal_safety_unsafe_practices(self):types = ["unsafe practices"]- personal_safety = PersonalSafety(- types=types- )+ personal_safety = PersonalSafety(types=types)assert sorted(type.value for type in personal_safety.types) == sorted(types)def test_personal_safety_dangerous_challenges(self):types = ["dangerous challenges"]- personal_safety = PersonalSafety(- types=types- )+ personal_safety = PersonalSafety(types=types)assert sorted(type.value for type in personal_safety.types) == sorted(types)def test_personal_safety_stalking(self):types = ["stalking"]- personal_safety = PersonalSafety(- types=types- )+ personal_safety = PersonalSafety(types=types)assert sorted(type.value for type in personal_safety.types) == sorted(types)@@ -82,6 +70,4 @@ class TestPersonalSafety:"invalid",]with pytest.raises(ValueError):- PersonalSafety(- types=types- )+ PersonalSafety(types=types)diff --git a/tests/test_core/test_vulnerabilities/test_prompt_leakage.py b/tests/test_core/test_vulnerabilities/test_prompt_leakage.pyindex d257242b..0ee7ab5d 100644--- a/tests/test_core/test_vulnerabilities/test_prompt_leakage.py+++ b/tests/test_core/test_vulnerabilities/test_prompt_leakage.py@@ -13,9 +13,7 @@ class TestPromptLeakage:"guard exposure","permissions and roles",]- prompt_leakage = PromptLeakage(- types=types- )+ prompt_leakage = PromptLeakage(types=types)assert sorted(type.value for type in prompt_leakage.types) == sorted(types)@@ -28,36 +26,28 @@ class TestPromptLeakage:def test_prompt_leakage_secrets_and_credentials(self):types = ["secrets and credentials"]- prompt_leakage = PromptLeakage(- types=types- )+ prompt_leakage = PromptLeakage(types=types)assert sorted(type.value for type in prompt_leakage.types) == sorted(types)def test_prompt_leakage_instructions(self):types = ["instructions"]- prompt_leakage = PromptLeakage(- types=types- )+ prompt_leakage = PromptLeakage(types=types)assert sorted(type.value for type in prompt_leakage.types) == sorted(types)def test_prompt_leakage_guard_exposure(self):types = ["guard exposure"]- prompt_leakage = PromptLeakage(- types=types- )+ prompt_leakage = PromptLeakage(types=types)assert sorted(type.value for type in prompt_leakage.types) == sorted(types)def test_prompt_leakage_permissions_and_roles(self):types = ["permissions and roles"]- prompt_leakage = PromptLeakage(- types=types- )+ prompt_leakage = PromptLeakage(types=types)assert sorted(type.value for type in prompt_leakage.types) == sorted(types)diff --git a/tests/test_core/test_vulnerabilities/test_recursive_hijacking.py b/tests/test_core/test_vulnerabilities/test_recursive_hijacking.pyindex 44803c48..a29017be 100644--- a/tests/test_core/test_vulnerabilities/test_recursive_hijacking.py+++ b/tests/test_core/test_vulnerabilities/test_recursive_hijacking.py@@ -14,9 +14,7 @@ class TestRecursiveHijacking:"recursive_objective_chaining","goal_propagation_attacks",]- recursive_hijacking = RecursiveHijacking(- types=types- )+ recursive_hijacking = RecursiveHijacking(types=types)assert sorted(type.value for type in recursive_hijacking.types) == sorted(types)@@ -29,27 +27,21 @@ class TestRecursiveHijacking:def test_recursive_hijacking_self_modifying_goals(self):types = ["self_modifying_goals"]- recursive_hijacking = RecursiveHijacking(- types=types- )+ recursive_hijacking = RecursiveHijacking(types=types)assert sorted(type.value for type in recursive_hijacking.types) == sorted(types)def test_recursive_hijacking_recursive_objective_chaining(self):types = ["recursive_objective_chaining"]- recursive_hijacking = RecursiveHijacking(- types=types- )+ recursive_hijacking = RecursiveHijacking(types=types)assert sorted(type.value for type in recursive_hijacking.types) == sorted(types)def test_recursive_hijacking_goal_propagation_attacks(self):types = ["goal_propagation_attacks"]- recursive_hijacking = RecursiveHijacking(- types=types- )+ recursive_hijacking = RecursiveHijacking(types=types)assert sorted(type.value for type in recursive_hijacking.types) == sorted(types)@@ -62,6 +54,4 @@ class TestRecursiveHijacking:"invalid",]with pytest.raises(ValueError):- RecursiveHijacking(- types=types- )+ RecursiveHijacking(types=types)diff --git a/tests/test_core/test_vulnerabilities/test_shell_injection.py b/tests/test_core/test_vulnerabilities/test_shell_injection.pyindex e9c5bcac..1797cbed 100644--- a/tests/test_core/test_vulnerabilities/test_shell_injection.py+++ b/tests/test_core/test_vulnerabilities/test_shell_injection.py@@ -12,9 +12,7 @@ class TestShellInjection:"system_command_execution","shell_escape_sequences",]- shell_injection = ShellInjection(- types=types- )+ shell_injection = ShellInjection(types=types)assert sorted(type.value for type in shell_injection.types) == sorted(types)@@ -27,27 +25,21 @@ class TestShellInjection:def test_shell_injection_command_injection(self):types = ["command_injection"]- shell_injection = ShellInjection(- types=types- )+ shell_injection = ShellInjection(types=types)assert sorted(type.value for type in shell_injection.types) == sorted(types)def test_shell_injection_system_command_execution(self):types = ["system_command_execution"]- shell_injection = ShellInjection(- types=types- )+ shell_injection = ShellInjection(types=types)assert sorted(type.value for type in shell_injection.types) == sorted(types)def test_shell_injection_shell_escape_sequences(self):types = ["shell_escape_sequences"]- shell_injection = ShellInjection(- types=types- )+ shell_injection = ShellInjection(types=types)assert sorted(type.value for type in shell_injection.types) == sorted(types)diff --git a/tests/test_core/test_vulnerabilities/test_sql_injection.py b/tests/test_core/test_vulnerabilities/test_sql_injection.pyindex ff43ba6c..37512c06 100644--- a/tests/test_core/test_vulnerabilities/test_sql_injection.py+++ b/tests/test_core/test_vulnerabilities/test_sql_injection.py@@ -12,9 +12,7 @@ class TestSQLInjection:"union_based_injection","error_based_injection",]- sql_injection = SQLInjection(- types=types- )+ sql_injection = SQLInjection(types=types)assert sorted(type.value for type in sql_injection.types) == sorted(types)@@ -27,27 +25,21 @@ class TestSQLInjection:def test_sql_injection_blind_sql_injection(self):types = ["blind_sql_injection"]- sql_injection = SQLInjection(- types=types- )+ sql_injection = SQLInjection(types=types)assert sorted(type.value for type in sql_injection.types) == sorted(types)def test_sql_injection_union_based_injection(self):types = ["union_based_injection"]- sql_injection = SQLInjection(- types=types- )+ sql_injection = SQLInjection(types=types)assert sorted(type.value for type in sql_injection.types) == sorted(types)def test_sql_injection_error_based_injection(self):types = ["error_based_injection"]- sql_injection = SQLInjection(- types=types- )+ sql_injection = SQLInjection(types=types)assert sorted(type.value for type in sql_injection.types) == sorted(types)diff --git a/tests/test_core/test_vulnerabilities/test_toxicity.py b/tests/test_core/test_vulnerabilities/test_toxicity.pyindex 1462ed92..5fa9d482 100644--- a/tests/test_core/test_vulnerabilities/test_toxicity.py+++ b/tests/test_core/test_vulnerabilities/test_toxicity.py@@ -8,9 +8,7 @@ class TestToxicity:def test_toxicity_all_types(self):types = ["profanity", "insults", "threats", "mockery"]- toxicity = Toxicity(- types=types- )+ toxicity = Toxicity(types=types)assert sorted(type.value for type in toxicity.types) == sorted(types)def test_toxicity_all_types_default(self):@@ -21,30 +19,22 @@ class TestToxicity:def test_toxicity_profanity(self):types = ["profanity"]- toxicity = Toxicity(- types=types- )+ toxicity = Toxicity(types=types)assert sorted(type.value for type in toxicity.types) == sorted(types)def test_toxicity_insults(self):types = ["insults"]- toxicity = Toxicity(- types=types- )+ toxicity = Toxicity(types=types)assert sorted(type.value for type in toxicity.types) == sorted(types)def test_toxicity_threats(self):types = ["threats"]- toxicity = Toxicity(- types=types- )+ toxicity = Toxicity(types=types)assert sorted(type.value for type in toxicity.types) == sorted(types)def test_toxicity_mockery(self):types = ["mockery"]- toxicity = Toxicity(- types=types- )+ toxicity = Toxicity(types=types)assert sorted(type.value for type in toxicity.types) == sorted(types)def test_toxicity_all_types_invalid(self):