MCPcopy Create free account
hub / github.com/TheSecuredAnalyst/security-suite / insert_remediation

Function insert_remediation

core/db.py:244–269  ·  view source on GitHub ↗
(run_id: str, finding_id: int, rem: dict)

Source from the content-addressed store, hash-verified

242# ── Remediation CRUD ──────────────────────────────────────────────────────────
243
244def 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
272def list_remediations(run_id: str) -> list[dict]:

Callers 1

_persist_to_dbMethod · 0.90

Calls 2

get_dbFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected