Update dependency langchain to ^0.3.0 [SECURITY] #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^0.0.184→^0.3.0GitHub Vulnerability Alerts
CVE-2024-7774
A path traversal vulnerability exists in the
getFullPathmethod of langchain-ai/langchainjs version 0.2.5. This vulnerability allows attackers to save files anywhere in the filesystem, overwrite existing text files, read.txtfiles, and delete files. The vulnerability is exploited through thesetFileContent,getParsedFile, andmdeletemethods, which do not properly sanitize user input.CVE-2025-68665
Context
A serialization injection vulnerability exists in LangChain JS's
toJSON()method (and subsequently when string-ifying objects usingJSON.stringify(). The method did not escape objects with'lc'keys when serializing free-form data in kwargs. The'lc'key is used internally by LangChain to mark serialized objects. When user-controlled data contains this key structure, it is treated as a legitimate LangChain object during deserialization rather than plain user data.Attack surface
The core vulnerability was in
Serializable.toJSON(): this method failed to escape user-controlled objects containing'lc'keys within kwargs (e.g.,additional_kwargs,metadata,response_metadata). When this unescaped data was later deserialized viaload(), the injected structures were treated as legitimate LangChain objects rather than plain user data.This escaping bug enabled several attack vectors:
metadata,additional_kwargs, orresponse_metadatasecretsFromEnvwas enabled (which had no explicit default, effectively defaulting totruebehavior)Note on import maps: Classes must be explicitly included in import maps to be instantiatable. The core import map includes standard types (messages, prompts, documents), and users can extend this via
importMapandoptionalImportsMapoptions. This architecture naturally limits the attack surface—anallowedObjectsparameter is not necessary because users control which classes are available through the import maps they provide.Security hardening: This patch fixes the escaping bug in
toJSON()and introduces new restrictive defaults inload():secretsFromEnvnow explicitly defaults tofalse, and amaxDepthparameter protects against DoS via deeply nested structures. JSDoc security warnings have been added to all import map options.Who is affected?
Applications are vulnerable if they:
JSON.stringify()on Serializable objects, then deserialize withload()— Trusting your own serialization output makes you vulnerable if user-controlled data (e.g., from LLM responses, metadata fields, or user inputs) contains'lc'key structures.load()— Directly deserializing untrusted data that may contain injected'lc'structures.The most common attack vector is through LLM response fields like
additional_kwargsorresponse_metadata, which can be controlled via prompt injection and then serialized/deserialized in streaming operations.Impact
Attackers who control serialized data can extract environment variable secrets by injecting
{"lc": 1, "type": "secret", "id": ["ENV_VAR"]}to load environment variables during deserialization (whensecretsFromEnv: true). They can also instantiate classes with controlled parameters by injecting constructor structures to instantiate any class within the provided import maps with attacker-controlled parameters, potentially triggering side effects such as network calls or file operations.Key severity factors:
secretsFromEnv: trueadditional_kwargscan be controlled via prompt injectionExploit example
Security hardening changes
This patch introduces the following changes to
load():secretsFromEnvdefault changed tofalse: Disables automatic secret loading from environment variables. Secrets not found insecretsMapnow throw an error instead of being loaded fromprocess.env. This fail-safe behavior ensures missing secrets are caught immediately rather than silently continuing withnull.maxDepthparameter (defaults to50): Protects against denial-of-service attacks via deeply nested JSON structures that could cause stack overflow.toJSON(): User-controlled objects containing'lc'keys are now wrapped in{"__lc_escaped__": {...}}during serialization and unwrapped as plain data during deserialization.importMap,optionalImportsMap,optionalImportEntrypoints) now include security warnings about never populating them from user input.Migration guide
No changes needed for most users
If you're deserializing standard LangChain types (messages, documents, prompts) using the core import map, your code will work without changes:
For secrets from environment
secretsFromEnvnow defaults tofalse, and missing secrets throw an error. If you need to load secrets:For deeply nested structures
If you have legitimate deeply nested data that exceeds the default depth limit of 50:
For custom import maps
If you provide custom import maps, ensure they only contain trusted modules:
Release Notes
langchain-ai/langchainjs (langchain)
v0.3.37v0.3.36Compare Source
v0.3.35Compare Source
v0.3.34Compare Source
v0.3.33Compare Source
v0.3.32Compare Source
v0.3.31Compare Source
v0.3.30Compare Source
v0.3.29Compare Source
v0.3.28Compare Source
v0.3.27Compare Source
What's Changed
Runnable.bindby @benjamincburns in #8192window.LanguageModelby @jtpio in #8173New Contributors
Full Changelog: langchain-ai/langchainjs@0.3.26...0.3.27
v0.3.26Compare Source
What's Changed
Full Changelog: langchain-ai/langchainjs@0.3.25...0.3.26
v0.3.25Compare Source
What's Changed
ensureTableInDatabasein typeorm vectorstore. by @n1md7 in #4504New Contributors
Full Changelog: langchain-ai/langchainjs@0.3.24...0.3.25
v0.3.24Compare Source
What's Changed
New Contributors
Full Changelog: langchain-ai/langchainjs@0.3.23...0.3.24
v0.3.23Compare Source
What's Changed
New Contributors
Full Changelog: langchain-ai/langchainjs@0.3.22...0.3.23
v0.3.22Compare Source
Full Changelog: langchain-ai/langchainjs@0.3.21...0.3.22
v0.3.21Compare Source
What's Changed
stream: trueeven if streaming is not being done by @dqbd in #7959New Contributors
Full Changelog: langchain-ai/langchainjs@0.3.20...0.3.21
v0.3.20Compare Source
What's Changed
Invalid reasoning contentexception on empty reasoning chunk by @ChenNima in #7826Configuration
📅 Schedule: Branch creation - "" in timezone Europe/Oslo, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.