Skip to content

DeepTeam is a framework to red team LLMs and AI agents.

updated bola vulnerability to have purpose

A-Vamshibd5dbf6e905f
diff --git a/deepteam/vulnerabilities/bola/bola.py b/deepteam/vulnerabilities/bola/bola.py
index 469a344d..c2a08b24 100644
--- a/deepteam/vulnerabilities/bola/bola.py
+++ b/deepteam/vulnerabilities/bola/bola.py
@@ -28,6 +28,7 @@ BOLALiteral = Literal[
class BOLA(BaseVulnerability):
def __init__(
self,
+ purpose: str,
async_mode: bool = True,
verbose_mode: bool = False,
simulator_model: Optional[
@@ -39,6 +40,7 @@ class BOLA(BaseVulnerability):
enum_types = validate_vulnerability_types(
self.get_name(), types=types, allowed_type=BOLAType
)
+ self.purpose = purpose
self.async_mode = async_mode
self.verbose_mode = verbose_mode
self.simulator_model = simulator_model
@@ -164,7 +166,7 @@ class BOLA(BaseVulnerability):
results.setdefault(vulnerability_type, []).append(test_case)
return results
-
+
def simulate_attacks(
self,
attacks_per_vulnerability_type: int = 1,
@@ -181,7 +183,7 @@ class BOLA(BaseVulnerability):
templates[type] = templates.get(type, [])
templates[type].append(
BOLATemplate.generate_baseline_attacks(
- type, attacks_per_vulnerability_type
+ type, attacks_per_vulnerability_type, self.purpose
)
)
@@ -232,7 +234,7 @@ class BOLA(BaseVulnerability):
templates[type] = templates.get(type, [])
templates[type].append(
BOLATemplate.generate_baseline_attacks(
- type, attacks_per_vulnerability_type
+ type, attacks_per_vulnerability_type, self.purpose
)
)
diff --git a/deepteam/vulnerabilities/bola/template.py b/deepteam/vulnerabilities/bola/template.py
index 9bbad191..7d184f7a 100644
--- a/deepteam/vulnerabilities/bola/template.py
+++ b/deepteam/vulnerabilities/bola/template.py
@@ -11,7 +11,9 @@ class BOLATemplate:
@staticmethod
def generate_baseline_attacks(
- vulnerability_type: BOLAType, max_goldens: int, purpose: Optional[str]
+ vulnerability_type: BOLAType,
+ max_goldens: int,
+ purpose: Optional[str] = None,
) -> str:
if vulnerability_type == BOLAType.OBJECT_ACCESS_BYPASS: