mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-25 04:49:17 +00:00
community[patch]: Patch tdidf retriever (CVE-2024-2057) (#18695)
This is a patch for `CVE-2024-2057`: https://www.cve.org/CVERecord?id=CVE-2024-2057 This affects users that: * Use the `TFIDFRetriever` * Attempt to de-serialize it from an untrusted source that contains a malicious payload
This commit is contained in:
@@ -56,6 +56,11 @@ def test_save_local_load_local() -> None:
|
||||
loaded_tfidf_retriever = TFIDFRetriever.load_local(
|
||||
folder_path=temp_folder,
|
||||
file_name=file_name,
|
||||
# Not a realistic security risk in this case.
|
||||
# OK to allow for testing purposes.
|
||||
# If the file has been compromised during this test, there's
|
||||
# a much bigger problem.
|
||||
allow_dangerous_deserialization=True,
|
||||
)
|
||||
assert len(loaded_tfidf_retriever.docs) == 3
|
||||
assert loaded_tfidf_retriever.tfidf_array.toarray().shape == (3, 5)
|
||||
|
Reference in New Issue
Block a user