fix(deps): update dependency @langchain/core to v0.3.80 [security] #1669
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.3.79->0.3.80GitHub 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:
Configuration
📅 Schedule: Branch creation - "" in timezone Europe/Zurich, Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ 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.