Skip to content

Commit 41cebfe

Browse files
authored
chore(core): add admonitions around use of load (#34285)
1 parent 5350967 commit 41cebfe

File tree

1 file changed

+14
-1
lines changed
  • libs/core/langchain_core/load

1 file changed

+14
-1
lines changed

libs/core/langchain_core/load/load.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
"""Load LangChain objects from JSON strings or objects."""
1+
"""Load LangChain objects from JSON strings or objects.
2+
3+
!!! warning
4+
`load` and `loads` are vulnerable to remote code execution. Never use with untrusted
5+
input.
6+
"""
27

38
import importlib
49
import json
@@ -193,6 +198,10 @@ def loads(
193198
) -> Any:
194199
"""Revive a LangChain class from a JSON string.
195200
201+
!!! warning
202+
This function is vulnerable to remote code execution. Never use with untrusted
203+
input.
204+
196205
Equivalent to `load(json.loads(text))`.
197206
198207
Args:
@@ -236,6 +245,10 @@ def load(
236245
) -> Any:
237246
"""Revive a LangChain class from a JSON object.
238247
248+
!!! warning
249+
This function is vulnerable to remote code execution. Never use with untrusted
250+
input.
251+
239252
Use this if you already have a parsed JSON object,
240253
eg. from `json.load` or `orjson.loads`.
241254

0 commit comments

Comments
 (0)