Skip to content

Conversation

@renovate-bot
Copy link
Contributor

This PR contains the following updates:

Package Change Age Confidence
langchain-core (changelog) ==0.2.33==1.2.11 age confidence

GitHub Vulnerability Alerts

CVE-2026-26013

Server-Side Request Forgery (SSRF) in ChatOpenAI Image Token Counting

Summary

The ChatOpenAI.get_num_tokens_from_messages() method fetches arbitrary image_url values without validation when computing token counts for vision-enabled models. This allows attackers to trigger Server-Side Request Forgery (SSRF) attacks by providing malicious image URLs in user input.

Severity

Low - The vulnerability allows SSRF attacks but has limited impact due to:

  • Responses are not returned to the attacker (blind SSRF)
  • Default 5-second timeout limits resource exhaustion
  • Non-image responses fail at PIL image parsing

Impact

An attacker who can control image URLs passed to get_num_tokens_from_messages() can:

  • Trigger HTTP requests from the application server to arbitrary internal or external URLs
  • Cause the server to access internal network resources (private IPs, cloud metadata endpoints)
  • Cause minor resource consumption through image downloads (bounded by timeout)

Note: This vulnerability occurs during token counting, which may happen outside of model invocation (e.g., in logging, metrics, or token budgeting flows).

Details

The vulnerable code path:

  1. get_num_tokens_from_messages() processes messages containing image_url content blocks
  2. For images without detail: "low", it calls _url_to_size() to fetch the image and compute token counts
  3. _url_to_size() performs httpx.get(image_source) on any URL without validation
  4. Prior to the patch, there was no SSRF protection, size limits, or explicit timeout

File: libs/partners/openai/langchain_openai/chat_models/base.py

Patches

The vulnerability has been patched in langchain-openai==1.1.9 (requires langchain-core==1.2.11).

The patch adds:

  1. SSRF validation using langchain_core._security._ssrf_protection.validate_safe_url() to block:
    • Private IP ranges (RFC 1918, loopback, link-local)
    • Cloud metadata endpoints (169.254.169.254, etc.)
    • Invalid URL schemes
  2. Explicit size limits (50 MB maximum, matching OpenAI's payload limit)
  3. Explicit timeout (5 seconds, same as httpx.get default)
  4. Allow disabling image fetching via allow_fetching_images=False parameter

Workarounds

If you cannot upgrade immediately:

  1. Sanitize input: Validate and filter image_url values before passing messages to token counting or model invocation
  2. Use network controls: Implement egress filtering to prevent outbound requests to private IPs

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Never, 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-bot renovate-bot requested review from a team as code owners February 11, 2026 14:46
@trusted-contributions-gcf trusted-contributions-gcf bot added kokoro:force-run Add this label to force Kokoro to re-run the tests. owlbot:run Add this label to trigger the Owlbot post processor. labels Feb 11, 2026
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Feb 11, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @renovate-bot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a critical dependency upgrade to enhance the security posture of the project. By updating langchain-core, it mitigates a known SSRF vulnerability related to image URL processing, ensuring that applications using these dependencies are protected against malicious external requests during token counting operations. The change primarily involves updating version specifications in several dependency manifests.

Highlights

  • Dependency Update: Updated the langchain-core dependency from version 0.2.33 to 1.2.11 across multiple requirements.txt files.
  • Security Fix: This update addresses a Server-Side Request Forgery (SSRF) vulnerability (CVE-2026-26013) in the ChatOpenAI.get_num_tokens_from_messages() method, which previously fetched arbitrary image URLs without validation.
  • Enhanced Image Handling: The patched version introduces SSRF validation, explicit size limits (50 MB), and a 5-second timeout for image fetching, along with an option to disable image fetching via allow_fetching_images=False.
Changelog
  • generative_ai/evaluation/requirements.txt
    • Updated langchain-core to 1.2.11.
  • generative_ai/extensions/requirements.txt
    • Updated langchain-core to 1.2.11.
  • generative_ai/image_generation/requirements.txt
    • Updated langchain-core to 1.2.11.
  • generative_ai/model_garden/requirements.txt
    • Updated langchain-core to 1.2.11.
  • generative_ai/model_tuning/requirements.txt
    • Updated langchain-core to 1.2.11.
  • generative_ai/prompts/requirements.txt
    • Updated langchain-core to 1.2.11.
  • generative_ai/reasoning_engine/requirements.txt
    • Updated langchain-core to 1.2.11.
Activity
  • This pull request was automatically generated by Renovate Bot to update the langchain-core dependency.
  • Automerge is currently disabled, requiring manual review and merge.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 11, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This PR updates langchain-core across several requirements.txt files to address a security vulnerability. My review has identified two main concerns. First, this is a major version upgrade, which carries a risk of breaking changes. This risk is amplified by the presence of multiple skipped tests in the project's test suite. It is critical to run a full, un-skipped test suite to validate this change. Second, the security fix is for a vulnerability in langchain-openai, but this package is not listed as a dependency. To fully remediate the vulnerability, langchain-openai should be explicitly added and updated if it's in use.

google-auth==2.38.0
anthropic[vertex]==0.28.0
langchain-core==0.2.33
langchain-core==1.2.11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Updating langchain-core to a new major version (0.2.x to 1.x) introduces a significant risk of breaking changes. The project's test suite contains multiple skipped tests (e.g., in generative_ai/reasoning_engine/test_reasoning_engine_examples.py and generative_ai/model_tuning/supervised_tuning_examples_test.py), which means that potential regressions introduced by this upgrade may not be caught. It is critical to enable and run the full test suite to validate this change before merging.

google-auth==2.38.0
anthropic[vertex]==0.28.0
langchain-core==0.2.33
langchain-core==1.2.11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This update addresses CVE-2026-26013, a vulnerability in the langchain-openai package. The patch is in langchain-openai>=1.1.9, which requires langchain-core>=1.2.11. While this PR correctly updates langchain-core, the langchain-openai package is not listed as a dependency. If the project uses langchain-openai, it must be explicitly added to the requirements (e.g., langchain-openai>=1.1.9) to ensure the vulnerability is fully remediated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owlbot:run Add this label to trigger the Owlbot post processor. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants