Spaces:
Sleeping
Sleeping
Delete models.py
Browse files
models.py
DELETED
|
@@ -1,90 +0,0 @@
|
|
| 1 |
-
from __future__ import annotations
|
| 2 |
-
|
| 3 |
-
from typing import Any, Dict, List, Literal, Optional
|
| 4 |
-
|
| 5 |
-
from pydantic import Field
|
| 6 |
-
|
| 7 |
-
try:
|
| 8 |
-
from core.env_server.types import Action, Observation, State
|
| 9 |
-
except ImportError:
|
| 10 |
-
try:
|
| 11 |
-
from openenv.core.env_server.types import Action, Observation, State
|
| 12 |
-
except ImportError:
|
| 13 |
-
from openenv_core.env_server.types import Action, Observation, State
|
| 14 |
-
|
| 15 |
-
ActionType = Literal["inspect_file", "submit_finding", "submit_final_report"]
|
| 16 |
-
VulnerabilityType = Literal[
|
| 17 |
-
"sql_injection",
|
| 18 |
-
"command_injection",
|
| 19 |
-
"path_traversal",
|
| 20 |
-
"weak_authentication",
|
| 21 |
-
"insecure_deserialization",
|
| 22 |
-
"ssrf",
|
| 23 |
-
"hardcoded_secret",
|
| 24 |
-
"xss",
|
| 25 |
-
]
|
| 26 |
-
Severity = Literal["low", "medium", "high", "critical"]
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
class CodeSecurityAction(Action):
|
| 30 |
-
"""Action sent by the agent during a security audit episode."""
|
| 31 |
-
|
| 32 |
-
action_type: ActionType
|
| 33 |
-
filename: Optional[str] = None
|
| 34 |
-
line_start: Optional[int] = Field(default=None, ge=1)
|
| 35 |
-
line_end: Optional[int] = Field(default=None, ge=1)
|
| 36 |
-
vuln_type: Optional[VulnerabilityType] = None
|
| 37 |
-
severity: Optional[Severity] = None
|
| 38 |
-
confidence: float = Field(default=0.5, ge=0.0, le=1.0)
|
| 39 |
-
evidence: str = ""
|
| 40 |
-
summary: str = ""
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
class FindingRecord(State):
|
| 44 |
-
"""Stored record of one submitted finding."""
|
| 45 |
-
|
| 46 |
-
finding_id: str
|
| 47 |
-
filename: str
|
| 48 |
-
line_start: int
|
| 49 |
-
line_end: int
|
| 50 |
-
vuln_type: str
|
| 51 |
-
severity: str
|
| 52 |
-
confidence: float
|
| 53 |
-
evidence: str
|
| 54 |
-
summary: str
|
| 55 |
-
matched_vulnerability_id: Optional[str] = None
|
| 56 |
-
component_score: float = 0.0
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
class CodeSecurityObservation(Observation):
|
| 60 |
-
"""Observation returned after reset() and step()."""
|
| 61 |
-
|
| 62 |
-
task_id: str
|
| 63 |
-
task_title: str
|
| 64 |
-
difficulty: str
|
| 65 |
-
objective: str
|
| 66 |
-
instructions: str
|
| 67 |
-
available_files: List[str] = Field(default_factory=list)
|
| 68 |
-
focused_file: Optional[str] = None
|
| 69 |
-
file_excerpt: str = ""
|
| 70 |
-
findings_so_far: List[Dict[str, Any]] = Field(default_factory=list)
|
| 71 |
-
steps_remaining: int = 0
|
| 72 |
-
last_feedback: str = ""
|
| 73 |
-
score_hint: float = Field(default=0.0, ge=0.0, le=1.0)
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
class CodeSecurityState(State):
|
| 77 |
-
"""Internal environment state for the current security auditing episode."""
|
| 78 |
-
|
| 79 |
-
task_id: str = ""
|
| 80 |
-
task_title: str = ""
|
| 81 |
-
difficulty: str = ""
|
| 82 |
-
objective: str = ""
|
| 83 |
-
max_steps: int = 0
|
| 84 |
-
inspected_files: List[str] = Field(default_factory=list)
|
| 85 |
-
findings_submitted: List[FindingRecord] = Field(default_factory=list)
|
| 86 |
-
matched_vulnerability_ids: List[str] = Field(default_factory=list)
|
| 87 |
-
false_positive_count: int = 0
|
| 88 |
-
duplicate_submission_count: int = 0
|
| 89 |
-
quality_multiplier: float = 1.0
|
| 90 |
-
final_score: Optional[float] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|