From 699475a01d825e57e070f9efcefd0a4d367fa022 Mon Sep 17 00:00:00 2001 From: Jiwon Kang <113921639+J1W0N-1209@users.noreply.github.com> Date: Sun, 23 Mar 2025 04:27:49 +0900 Subject: [PATCH] community: uuidv1 is unsafe (#30432) this_row_id previously used UUID v1. However, since UUID v1 can be predicted if the MAC address and timestamp are known, it poses a potential security risk. Therefore, it has been changed to UUID v4. --- .../langchain_community/chat_message_histories/cassandra.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/community/langchain_community/chat_message_histories/cassandra.py b/libs/community/langchain_community/chat_message_histories/cassandra.py index f35ea5cede7..4ffd1ac8cee 100644 --- a/libs/community/langchain_community/chat_message_histories/cassandra.py +++ b/libs/community/langchain_community/chat_message_histories/cassandra.py @@ -103,7 +103,7 @@ class CassandraChatMessageHistory(BaseChatMessageHistory): Args: message: A message to write. """ - this_row_id = uuid.uuid1() + this_row_id = uuid.uuid4() self.table.put( partition_id=self.session_id, row_id=this_row_id, @@ -113,7 +113,7 @@ class CassandraChatMessageHistory(BaseChatMessageHistory): async def aadd_messages(self, messages: Sequence[BaseMessage]) -> None: for message in messages: - this_row_id = uuid.uuid1() + this_row_id = uuid.uuid4() await self.table.aput( partition_id=self.session_id, row_id=this_row_id,