Update dependency langchain to v1.2.3 [SECURITY]#135
Open
renovate[bot] wants to merge 1 commit intomainfrom
Open
Update dependency langchain to v1.2.3 [SECURITY]#135renovate[bot] wants to merge 1 commit intomainfrom
renovate[bot] wants to merge 1 commit intomainfrom
Conversation
061e341 to
d8d1b72
Compare
d8d1b72 to
2cfaf37
Compare
1275977 to
3c28b03
Compare
3c28b03 to
c871af7
Compare
c871af7 to
6b2943b
Compare
6b2943b to
7fd985d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
1.1.5→1.2.3GitHub Vulnerability Alerts
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)
v1.2.3Patch Changes
#9707
e5063f9Thanks @hntrl! - add security hardening forloadUpdated dependencies [
e5063f9,8996647]:v1.2.2Patch Changes
3efe79cThanks @christian-bromann! - fix(core): properly elevate reasoning tokensv1.2.1Compare Source
Patch Changes
a7b2a7d,a496c5f,1da1325]:v1.2.0Compare Source
Minor Changes
442197dThanks @Gulianrdgd! - Adds support for thethinkparameter to theOllamaLLM classPatch Changes
3efe79cThanks @christian-bromann! - fix(core): properly elevate reasoning tokensv1.1.6Compare Source
Patch Changes
#9835
adb3625Thanks @maahir30! - Use UTF-8 byte length for metadata fieldsUpdated dependencies []:
Configuration
📅 Schedule: Branch creation - "" in timezone Asia/Manila, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, 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.