diff --git a/src/defectdojo/findings_tools.py b/src/defectdojo/findings_tools.py index aea1b22..1c64487 100644 --- a/src/defectdojo/findings_tools.py +++ b/src/defectdojo/findings_tools.py @@ -170,10 +170,12 @@ async def add_finding_note(finding_id: int, note: str) -> Dict[str, Any]: return {"status": "success", "data": result} -async def create_finding(title: str, test_id: int, severity: str, description: str, +async def create_finding(title: str, test_id: int, severity: str, description: str, found_by: list, cwe: Optional[int] = None, cvssv3: Optional[str] = None, mitigation: Optional[str] = None, impact: Optional[str] = None, - steps_to_reproduce: Optional[str] = None) -> Dict[str, Any]: + steps_to_reproduce: Optional[str] = None, + numerical_severity: Optional[str] = "S2" + ) -> Dict[str, Any]: """Create a new finding. Args: @@ -181,11 +183,13 @@ async def create_finding(title: str, test_id: int, severity: str, description: s test_id: ID of the test to associate the finding with severity: Severity level (Critical, High, Medium, Low, Info) description: Description of the finding + found_by: Required ID of the origin test of the finding cwe: Optional CWE identifier cvssv3: Optional CVSS v3 score string mitigation: Optional mitigation steps impact: Optional impact description steps_to_reproduce: Optional steps to reproduce + numerical_severity: Optional numerical representation of the severity (default: S2) Returns: Dictionary with status and data/error @@ -206,10 +210,11 @@ async def create_finding(title: str, test_id: int, severity: str, description: s "test": test_id, "severity": api_severity, "description": description, + "found_by": found_by, # Set defaults expected by API if not provided explicitly by user? # e.g., "active": True, "verified": False? Check API docs. "active": True, - "verified": False, + "verified": False } # Add optional fields if provided @@ -223,6 +228,8 @@ async def create_finding(title: str, test_id: int, severity: str, description: s data["impact"] = impact if steps_to_reproduce: data["steps_to_reproduce"] = steps_to_reproduce + if numerical_severity: + data["numerical_severity"] = numerical_severity client = get_client() result = await client.create_finding(data)