Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

Use timezone-aware Scan start defaults

Ghraven0a47d8b625e6
diff --git a/flowsint-core/src/flowsint_core/core/models.py b/flowsint-core/src/flowsint_core/core/models.py
index 2b6eab6a..daf7d269 100644
--- a/flowsint-core/src/flowsint_core/core/models.py
+++ b/flowsint-core/src/flowsint_core/core/models.py
@@ -129,7 +129,7 @@ class Scan(Base):
nullable=True,
)
status = Column(SQLEnum(EventLevel), default=EventLevel.PENDING)
- started_at = Column(DateTime, default=datetime.utcnow)
+ started_at = Column(DateTime, default=lambda: datetime.now(timezone.utc))
completed_at = Column(DateTime, nullable=True)
error = Column(Text, nullable=True)
details = Column(JSON, nullable=True)
diff --git a/flowsint-core/tests/factories.py b/flowsint-core/tests/factories.py
index c4557170..31aeda7d 100644
--- a/flowsint-core/tests/factories.py
+++ b/flowsint-core/tests/factories.py
@@ -127,7 +127,7 @@ class ScanFactory(SQLAlchemyModelFactory):
sketch = factory.SubFactory(SketchFactory)
sketch_id = factory.LazyAttribute(lambda o: o.sketch.id)
status = EventLevel.PENDING
- started_at = factory.LazyFunction(datetime.utcnow)
+ started_at = factory.LazyFunction(lambda: datetime.now(timezone.utc))
class LogFactory(SQLAlchemyModelFactory):