A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
fix(scan): persist results to existing details column, errors to error column
dextmorgn1d409d7929b4
diff --git a/flowsint-api/app/api/schemas/scan.py b/flowsint-api/app/api/schemas/scan.pyindex b39d4aa1..f1e70f9b 100644--- a/flowsint-api/app/api/schemas/scan.py+++ b/flowsint-api/app/api/schemas/scan.py@@ -8,7 +8,7 @@ class ScanCreate(BaseModel):values: Optional[List[str]] = Nonesketch_id: Optional[UUID4] = Nonestatus: Optional[str] = None- results: Optional[Any] = None+ details: Optional[Any] = Noneclass ScanRead(ORMBase):diff --git a/flowsint-core/src/flowsint_core/tasks/enricher.py b/flowsint-core/src/flowsint_core/tasks/enricher.pyindex f08ede65..1238f057 100644--- a/flowsint-core/src/flowsint_core/tasks/enricher.py+++ b/flowsint-core/src/flowsint_core/tasks/enricher.py@@ -69,10 +69,10 @@ def run_enricher(results = asyncio.run(enricher.execute(values=serialized_objects))scan.status = EventLevel.COMPLETED- scan.results = to_json_serializable(results)+ scan.details = to_json_serializable(results)session.commit()- return {"result": scan.results}+ return {"result": scan.details}except Exception as ex:session.rollback()@@ -82,7 +82,7 @@ def run_enricher(scan = session.query(Scan).filter(Scan.id == uuid.UUID(self.request.id)).first()if scan:scan.status = EventLevel.FAILED- scan.results = {"error": error_logs}+ scan.error = error_logssession.commit()self.update_state(state=states.FAILURE)@@ -145,10 +145,10 @@ def run_template_enricher(results = asyncio.run(enricher.execute(values=serialized_objects))scan.status = EventLevel.COMPLETED- scan.results = to_json_serializable(results)+ scan.details = to_json_serializable(results)session.commit()- return {"result": scan.results}+ return {"result": scan.details}except Exception as ex:session.rollback()@@ -162,7 +162,7 @@ def run_template_enricher()if scan:scan.status = EventLevel.FAILED- scan.results = {"error": error_logs}+ scan.error = error_logssession.commit()self.update_state(state=states.FAILURE)diff --git a/flowsint-core/src/flowsint_core/tasks/flow.py b/flowsint-core/src/flowsint_core/tasks/flow.pyindex ebce0256..25cc2c46 100644--- a/flowsint-core/src/flowsint_core/tasks/flow.py+++ b/flowsint-core/src/flowsint_core/tasks/flow.py@@ -65,10 +65,10 @@ def run_flow(results = enricher.scan(values=serialized_objects)scan.status = EventLevel.COMPLETED- scan.results = to_json_serializable(results)+ scan.details = to_json_serializable(results)session.commit()- return {"result": scan.results}+ return {"result": scan.details}except Exception as ex:session.rollback()@@ -78,7 +78,7 @@ def run_flow(scan = session.query(Scan).filter(Scan.id == uuid.UUID(self.request.id)).first()if scan:scan.status = EventLevel.FAILED- scan.results = {"error": error_logs}+ scan.error = error_logssession.commit()self.update_state(state=states.FAILURE)