Skip to content

Update dependency @langchain/core to v0.3.80 [SECURITY]#4036

Open
renovate[bot] wants to merge 1 commit intomainfrom
renovate/npm-langchain-core-vulnerability
Open

Update dependency @langchain/core to v0.3.80 [SECURITY]#4036
renovate[bot] wants to merge 1 commit intomainfrom
renovate/npm-langchain-core-vulnerability

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented Dec 23, 2025

This PR contains the following updates:

Package Change Age Confidence
@langchain/core (source) 0.3.780.3.80 age confidence

LangChain serialization injection vulnerability enables secret extraction

CVE-2025-68665 / GHSA-r399-636x-v7f6

More information

Details

Context

A serialization injection vulnerability exists in LangChain JS's toJSON() method (and subsequently when string-ifying objects using JSON.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 via load(), the injected structures were treated as legitimate LangChain objects rather than plain user data.

This escaping bug enabled several attack vectors:

  1. Injection via user data: Malicious LangChain object structures could be injected through user-controlled fields like metadata, additional_kwargs, or response_metadata
  2. Secret extraction: Injected secret structures could extract environment variables when secretsFromEnv was enabled (which had no explicit default, effectively defaulting to true behavior)
  3. Class instantiation via import maps: Injected constructor structures could instantiate any class available in the provided import maps with attacker-controlled parameters

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 importMap and optionalImportsMap options. This architecture naturally limits the attack surface—an allowedObjects parameter 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 in load(): secretsFromEnv now explicitly defaults to false, and a maxDepth parameter 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:

  1. Serialize untrusted data via JSON.stringify() on Serializable objects, then deserialize with load() — 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.
  2. Deserialize untrusted data with load() — Directly deserializing untrusted data that may contain injected 'lc' structures.
  3. Use LangGraph checkpoints — Checkpoint serialization/deserialization paths may be affected.

The most common attack vector is through LLM response fields like additional_kwargs or response_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 (when secretsFromEnv: 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:

  • Affects the serialization path—applications trusting their own serialization output are vulnerable
  • Enables secret extraction when combined with secretsFromEnv: true
  • LLM responses in additional_kwargs can be controlled via prompt injection
Exploit example
import { load } from "@​langchain/core/load";

// Attacker injects secret structure into user-controlled data
const attackerPayload = JSON.stringify({
  user_data: {
    lc: 1,
    type: "secret",
    id: ["OPENAI_API_KEY"],
  },
});

process.env.OPENAI_API_KEY = "sk-secret-key-12345";

// With secretsFromEnv: true, the secret is extracted
const deserialized = await load(attackerPayload, { secretsFromEnv: true });

console.log(deserialized.user_data); // "sk-secret-key-12345" - SECRET LEAKED!
Security hardening changes

This patch introduces the following changes to load():

  1. secretsFromEnv default changed to false: Disables automatic secret loading from environment variables. Secrets not found in secretsMap now throw an error instead of being loaded from process.env. This fail-safe behavior ensures missing secrets are caught immediately rather than silently continuing with null.
  2. New maxDepth parameter (defaults to 50): Protects against denial-of-service attacks via deeply nested JSON structures that could cause stack overflow.
  3. Escape mechanism in toJSON(): User-controlled objects containing 'lc' keys are now wrapped in {"__lc_escaped__": {...}} during serialization and unwrapped as plain data during deserialization.
  4. JSDoc security warnings: All import map options (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:

import { load } from "@​langchain/core/load";

// Works with default settings
const obj = await load(serializedData);
For secrets from environment

secretsFromEnv now defaults to false, and missing secrets throw an error. If you need to load secrets:

import { load } from "@​langchain/core/load";

// Provide secrets explicitly (recommended)
const obj = await load(serializedData, {
  secretsMap: { OPENAI_API_KEY: process.env.OPENAI_API_KEY },
});

// Or explicitly opt-in to load from env (only use with trusted data)
const obj = await load(serializedData, { secretsFromEnv: true });

Warning: Only enable secretsFromEnv if you trust the serialized data. Untrusted data could extract any environment variable.

Note: If a secret reference is encountered but not found in secretsMap (and secretsFromEnv is false or the secret is not in the environment), an error is thrown. This fail-safe behavior ensures you're aware of missing secrets rather than silently receiving null values.

For deeply nested structures

If you have legitimate deeply nested data that exceeds the default depth limit of 50:

import { load } from "@​langchain/core/load";

const obj = await load(serializedData, { maxDepth: 100 });
For custom import maps

If you provide custom import maps, ensure they only contain trusted modules:

import { load } from "@​langchain/core/load";
import * as myModule from "./my-trusted-module";

// GOOD - explicitly include only trusted modules
const obj = await load(serializedData, {
  importMap: { my_module: myModule },
});

// BAD - never populate from user input
const obj = await load(serializedData, {
  importMap: userProvidedImports, // DANGEROUS!
});

Severity

  • CVSS Score: 8.6 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • ""
  • 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.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot requested a review from a team as a code owner December 23, 2025 20:21
@renovate renovate Bot requested review from NoritakaIkeda, junkisai and sasamuku and removed request for a team December 23, 2025 20:21
@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
liam-app Ready Ready Preview, Comment Apr 29, 2026 7:06pm
liam-assets Ready Ready Preview, Comment Apr 29, 2026 7:06pm
liam-docs Ready Ready Preview, Comment Apr 29, 2026 7:06pm
liam-erd-sample Ready Ready Preview Apr 29, 2026 7:06pm
liam-storybook Ready Ready Preview, Comment Apr 29, 2026 7:06pm

Request Review

@vercel vercel Bot temporarily deployed to Preview – liam-erd-sample December 23, 2025 20:21 Inactive
@giselles-ai
Copy link
Copy Markdown

giselles-ai Bot commented Dec 23, 2025

Finished running flow.

Step 1
🟢
On Pull Request OpenedStatus: Success Updated: Dec 23, 2025 8:21pm
Step 2
🟢
gpt-5Status: Success Updated: Dec 23, 2025 8:22pm
Step 3
🟢
Create Pull Request CommentStatus: Success Updated: Dec 23, 2025 8:22pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 23, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Comment @coderabbitai help to get the list of available commands and usage tips.

@giselles-ai
Copy link
Copy Markdown

giselles-ai Bot commented Dec 23, 2025

Check changeset necessity

Status: NOT REQUIRED

Reason:

  • Only dependency updates in ignored packages: frontend/apps/app (@liam-hq/app) and frontend/internal-packages/agent (@liam-hq/agent) bump @langchain/core 0.3.78 -> 0.3.80.
  • No changes to target packages that require versioning: @liam-hq/cli, @liam-hq/erd-core, @liam-hq/schema, or @liam-hq/ui.
  • The update is dependency-only and does not introduce user-facing changes to any publishable package.
  • Although it addresses a security advisory, its impact is confined to ignored packages per the guide.

Changeset (copy & paste):

N/A – no changeset required for this PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 4, 2026

🤖 Agent Deep Modeling Execution

Started at: 2026-04-29 19:06:37 UTC

View Details

Command Output

@liam-hq/agent@0.1.0 execute-deep-modeling /home/runner/work/liam/liam/frontend/internal-packages/agent
pnpm test:integration src/createGraph.integration.test.ts

@liam-hq/agent@0.1.0 test:integration /home/runner/work/liam/liam/frontend/internal-packages/agent
vitest --watch=false --passWithNoTests --config vitest.config.integration.ts src/createGraph.integration.test.ts

RUN v3.2.4 /home/runner/work/liam/liam/frontend/internal-packages/agent

(node:8729) ExperimentalWarning: WASI is an experimental feature and might change at any time
(Use node --trace-warnings ... to show where the warning was created)

✅ [INFO] 2026-04-29T19:06:40.067Z
LangSmith Trace URL: https://smith.langchain.com/o/eed4d2d8-0bd8-4ca4-a452-4da88ef63fd6/projects/p/9324fe51-27a4-4604-a52b-c6cc240f6dcc?searchModel=%7B%22filter%22%3A%22and(eq(is_root%2C%20true)%2C%20and(eq(metadata_key%2C%20%5C%22thread_id%5C%22)%2C%20eq(metadata_value%2C%20%5C%223a45ebe2-7720-4702-8cd1-11ec33b624cd%5C%22)))%22%7D
stderr | src/createGraph.integration.test.ts > createGraph Integration > should execute complete workflow
Failed to Failed to send multipart request. Received status [403]: Forbidden. Message:

Context: trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=0b4fb9e2-5381-431d-bf21-e85fe3b1402d; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=6fc237d7-b3e2-492b-9e92-8264f7f7e405; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=1ac437a3-269d-494e-8e84-e4d404609365; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=e1d5ea1a-83e3-42c2-bc72-d563c6981b8c; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=fb5d0af6-2bde-453a-ab71-8bc970f375c3; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=ba1c7e1d-4173-4515-8a92-18071e401db4; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=33e4b782-dfcc-43f7-8667-4ae6315dda8f; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=eee55e02-19d1-4a77-9947-3f7b03bcb663; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=8ef63fb6-564b-40e3-81d6-51e6f1730506; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=e5acfae7-d418-48c1-b7bd-2034dbdb0804; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=5c2be500-192a-4322-b3d2-770ca934913e; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=143dd071-48c9-4ab5-abc0-3a355fe3252f; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=7fa67343-2534-4a99-9f77-8465cf2952bd; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=159f3751-0101-4e60-92df-3b1aaaed37f6; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=552a4171-33ae-41a8-a166-6a5dcafc6eb2; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=6731ccea-7457-4df8-80a7-bbf588c6e18f; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=3f295d50-c03a-4c82-b9c7-a09a2e4db027; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=abb27902-19a9-458d-bf79-9b855fd74817; trace=d16ba054-434e-4bd2-a1d4-a1f189d0e5c7,id=cc89b971-d0f9-49f3-b2e5-d7616559942f

x

⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯

FAIL src/createGraph.integration.test.ts > createGraph Integration > should execute complete workflow
WorkflowTerminationError: Error in analyzeRequirementsNode: 401 Incorrect API key provided: sk-proj-********************************************************************************************************************************************************N7kA. You can find your API key at https://platform.openai.com/account/api-keys.

Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/MODEL_AUTHENTICATION/

❯ RunnableCallable.analyzeRequirementsNode [as func] src/pm-agent/nodes/analyzeRequirementsNode.ts:38:11
36|
37| if (analysisResult.isErr()) {
38| throw new WorkflowTerminationError(
| ^
39| analysisResult.error,
40| 'analyzeRequirementsNode',
❯ RunnableCallable.invoke ../../../node_modules/.pnpm/@langchain+langgraph@0.4.9_@langchain+core@0.3.80_@opentelemetry+api@1.9.0_@opentelemet_9dd4ceecb24074f29d903c3f1eac6e7d/node_modules/@langchain/langgraph/src/utils.ts:85:21
❯ RunnableSequence.invoke ../../../node_modules/.pnpm/@langchain+core@0.3.80_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@2.2.0_@op_c97c613218c417a4275844ab8c29bdf1/node_modules/@langchain/core/dist/runnables/base.js:1308:33
runWithRetry ../../../node_modules/.pnpm/@langchain+langgraph@0.4.9@langchain+core@0.3.80_@opentelemetry+api@1.9.0_@opentelemet_9dd4ceecb24074f29d903c3f1eac6e7d/node_modules/@langchain/langgraph/src/pregel/retry.ts:103:16
❯ PregelRunner.executeTasksWithRetry ../../../node_modules/.pnpm/@langchain+langgraph@0.4.9@langchain+core@0.3.80_@opentelemetry+api@1.9.0_@opentelemet_9dd4ceecb24074f29d903c3f1eac6e7d/node_modules/@langchain/langgraph/src/pregel/runner.ts:330:27
❯ PregelRunner.tick ../../../node_modules/.pnpm/@langchain+langgraph@0.4.9_@langchain+core@0.3.80_@opentelemetry+api@1.9.0_@opentelemet_9dd4ceecb24074f29d903c3f1eac6e7d/node_modules/@langchain/langgraph/src/pregel/runner.ts:138:50
❯ CompiledStateGraph.runLoop ../../../node_modules/.pnpm/@langchain+langgraph@0.4.9@langchain+core@0.3.80_@opentelemetry+api@1.9.0_@opentelemet_9dd4ceecb24074f29d903c3f1eac6e7d/node_modules/@langchain/langgraph/src/pregel/index.ts:2233:9
❯ createAndRunLoop ../../../node_modules/.pnpm/@langchain+langgraph@0.4.9_@langchain+core@0.3.80_@opentelemetry+api@1.9.0_@opentelemet_9dd4ceecb24074f29d903c3f1eac6e7d/node_modules/@langchain/langgraph/src/pregel/index.ts:2092:9

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

Test Files 1 failed (1)
Tests 1 failed (1)
Start at 19:06:38
Duration 2.28s (transform 472ms, setup 0ms, collect 1.46s, tests 508ms, environment 0ms, prepare 84ms)

 ELIFECYCLE  Command failed with exit code 1.
/home/runner/work/liam/liam/frontend/internal-packages/agent:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @liam-hq/agent@0.1.0 execute-deep-modeling: pnpm test:integration src/createGraph.integration.test.ts
Exit status 1

@renovate renovate Bot force-pushed the renovate/npm-langchain-core-vulnerability branch from 708488a to 7512bc4 Compare February 17, 2026 21:56
@renovate renovate Bot force-pushed the renovate/npm-langchain-core-vulnerability branch from 7512bc4 to 8a2ef88 Compare March 14, 2026 20:59
@renovate renovate Bot force-pushed the renovate/npm-langchain-core-vulnerability branch from 8a2ef88 to 7b25120 Compare April 16, 2026 04:24
@renovate renovate Bot changed the title fix(deps): update dependency @langchain/core to v0.3.80 [security] Update dependency @langchain/core to v0.3.80 [SECURITY] Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants