(run_id: str, finding_id: int, rem: dict)
| 242 | # ── Remediation CRUD ────────────────────────────────────────────────────────── |
| 243 | |
| 244 | def insert_remediation(run_id: str, finding_id: int, rem: dict) -> None: |
| 245 | sql = """ |
| 246 | INSERT INTO remediations |
| 247 | (run_id, finding_id, ip, port, service, cve_id, safe, |
| 248 | explanation, immediate_mitigation, permanent_fix, |
| 249 | rollback_script, verification_command, warnings, model_used, created_at) |
| 250 | VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) |
| 251 | """ |
| 252 | with get_db() as conn: |
| 253 | conn.execute(sql, [ |
| 254 | run_id, |
| 255 | finding_id, |
| 256 | rem.get("ip", ""), |
| 257 | rem.get("port", 0), |
| 258 | rem.get("service", ""), |
| 259 | rem.get("cve_id", ""), |
| 260 | int(rem.get("safe", False)), |
| 261 | rem.get("explanation", ""), |
| 262 | rem.get("immediate_mitigation", ""), |
| 263 | rem.get("permanent_fix", ""), |
| 264 | rem.get("rollback_script", ""), |
| 265 | rem.get("verification_command", ""), |
| 266 | json.dumps(rem.get("warnings", [])), |
| 267 | rem.get("model_used", ""), |
| 268 | datetime.now(timezone.utc).isoformat(), |
| 269 | ]) |
| 270 | |
| 271 | |
| 272 | def list_remediations(run_id: str) -> list[dict]: |
no test coverage detected