openclaw - ✅(Solved) Fix [Bug]: image_generate blocks local OpenAI-compatible endpoint on private IP (SSRF) even with browser.ssrfPolicy.dangerouslyAllowPrivateNetwork=true [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62879Fetched 2026-04-09 08:01:19
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×2cross-referenced ×1referenced ×1

Fix Action

Fix / Workaround

Blocks all local image generation via image_generate when the endpoint is on private/LAN IP (e.g., LocalAI at 192.168.x.x), even though the endpoint is valid and reachable. This prevents local/self-hosted image workflows and forces users to use public/cloud endpoints as a workaround.

Reason:

  • Core feature (image_generate) is unusable for a common self-hosted deployment pattern.
  • Affects local-first users directly.
  • Reliable workaround requires architecture changes (public proxy/tunnel), not just normal config tweaks.

PR fix notes

PR #63095: fix(openai): respect browser.ssrfPolicy.dangerouslyAllowPrivateNetwork in image_generate

Description (problem / solution / changelog)

Problem

When using image_generate with an OpenAI-compatible endpoint on a private network (e.g. LocalAI at http://192.168.1.15:8082/v1), the request is SSRF-blocked even when browser.ssrfPolicy.dangerouslyAllowPrivateNetwork is set to true:

[security] blocked URL fetch (url-fetch)
  target=http://192.168.1.15:8082/v1/images/generations
  reason=Blocked hostname or private/internal/special-use IP address

The root cause is shouldAllowPrivateImageEndpoint() in the OpenAI image generation provider. It only allowed private-network access for mock providers or localhost with a QA env var — it never read the SSRF policy config.

Fix

Check isPrivateNetworkOptInEnabled(cfg.browser?.ssrfPolicy) before falling through to the localhost-only allowlist. This uses the same shared SDK helper that other subsystems (Mattermost, Matrix, BlueBubbles, browser, etc.) already use for private-network opt-in.

Before: shouldAllowPrivateImageEndpoint returns false for any non-localhost private IP, regardless of config.
After: When browser.ssrfPolicy.dangerouslyAllowPrivateNetwork is true, the function returns true for all endpoints, allowing LAN-hosted image generation services.

Tests

  • Added test: private-network baseUrl with dangerouslyAllowPrivateNetwork: true passes allowPrivateNetwork: true through to the HTTP layer
  • Added test: private-network baseUrl without the opt-in still passes allowPrivateNetwork: false
  • All existing tests continue to pass (mock provider, localhost QA env var, edit mode)

Closes #62879

Changed files

  • extensions/openai/image-generation-provider.test.ts (modified, +87/-0)
  • extensions/openai/image-generation-provider.ts (modified, +4/-0)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

OpenClaw version

OpenClaw 2026.4.5 (3e72c03)

What I’m trying to do

Use image_generate with a local OpenAI-compatible image endpoint (LocalAI) on LAN:

  • Text model: vLLM (http://192.168.1.15:8000/v1)
  • Image model: LocalAI (http://192.168.1.15:8082/v1)

Config (relevant parts)

json5 { "models": { "mode": "merge", "providers": { "vllm": { "baseUrl": "http://192.168.1.15:8000/v1", "api": "openai-completions", "apiKey": "vllm-local", "models": [{ "id": "unsloth/Qwen3.5-35B-A3B-GGUF:UD-Q4_K_XL" }] }, "openai": { "baseUrl": "http://192.168.1.15:8082/v1", "api": "openai-completions", "apiKey": "local-noauth", "models": [{ "id": "flux2-klein" }] } } }, "agents": { "defaults": { "model": { "primary": "vllm/unsloth/Qwen3.5-35B-A3B-GGUF:UD-Q4_K_XL" }, "imageGenerationModel": { "primary": "openai/flux2-klein" } } }, "browser": { "ssrfPolicy": { "dangerouslyAllowPrivateNetwork": true } } }

Steps to reproduce

Repro steps

  1. Configure openai provider baseUrl to LocalAI LAN endpoint (http://192.168.1.15:8082/v1)
  2. Set agents.defaults.imageGenerationModel.primary to openai/flux2-klein
  3. Run image_generate with a simple prompt

Expected

OpenClaw should call the configured local endpoint and generate an image.

Actual

Tool fails with SSRF block on private IP: text [security] blocked URL fetch (url-fetch) target=http://192.168.1.15:8082/v1/images/generations reason=Blocked hostname or private/internal/special-use IP address [tools] image_generate failed: Blocked hostname or private/internal/special-use IP address raw_params={"prompt":"A simple, clean illustration of a red apple with a green leaf"}

Additional context

  • Direct call to LocalAI works:
  • GET /v1/models returns: {"object":"list","data":[{"id":"flux2-klein","object":"model"}]}
  • POST /v1/images/generations succeeds manually
  • So this appears to be OpenClaw-side SSRF handling in image_generate path.

Expected behavior

When imageGenerationModel is set to an OpenAI-compatible local endpoint (LocalAI at http://192.168.1.15:8082/v1), image_generate should call /v1/images/generations successfully and return a generated image. Private/LAN endpoint usage should work in this local setup (especially with browser.ssrfPolicy.dangerouslyAllowPrivateNetwork=true).

Actual behavior

image_generate fails before generation with SSRF/private-network blocking.

Log: [security] blocked URL fetch (url-fetch) target=http://192.168.1.15:8082/v1/images/generations reason=Blocked hostname or private/internal/special-use IP address [tools] image_generate failed: Blocked hostname or private/internal/special-use IP address

OpenClaw version

2026.4.5 (3e72c03)

Operating system

Ubuntu 26.04

Install method

Installer inside a VM

Model

flux2-klein

Provider / routing chain

openclaw -> localAI -> flux2-klein (All LAN, no proxies)

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Blocks all local image generation via image_generate when the endpoint is on private/LAN IP (e.g., LocalAI at 192.168.x.x), even though the endpoint is valid and reachable. This prevents local/self-hosted image workflows and forces users to use public/cloud endpoints as a workaround.

High (functional blocker for local image-generation setups).

Reason:

  • Core feature (image_generate) is unusable for a common self-hosted deployment pattern.
  • Affects local-first users directly.
  • Reliable workaround requires architecture changes (public proxy/tunnel), not just normal config tweaks.

Additional information

No response

extent analysis

TL;DR

The most likely fix is to adjust the SSRF policy configuration in OpenClaw to allow private network requests.

Guidance

  • Review the browser.ssrfPolicy configuration to ensure it is correctly set to allow private network requests. Specifically, verify that dangerouslyAllowPrivateNetwork is true.
  • Check if there are any additional SSRF policy settings that might be blocking the request to the local endpoint.
  • Consider testing the image_generate function with a different endpoint or model to isolate if the issue is specific to the LocalAI setup.
  • Verify that the LocalAI endpoint is correctly configured and accessible by testing it independently of OpenClaw.

Example

No specific code example is provided as the issue seems to be related to configuration rather than code.

Notes

The issue appears to be related to OpenClaw's SSRF handling, which is blocking requests to private IP addresses. Adjusting the SSRF policy configuration should resolve the issue. However, it is essential to carefully evaluate the security implications of allowing private network requests.

Recommendation

Apply a workaround by adjusting the SSRF policy configuration to allow private network requests, as this is a local setup and the private endpoint is intended to be used. This should resolve the issue without requiring an upgrade to a fixed version, as the problem seems to be with the current configuration rather than a bug in OpenClaw itself.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

When imageGenerationModel is set to an OpenAI-compatible local endpoint (LocalAI at http://192.168.1.15:8082/v1), image_generate should call /v1/images/generations successfully and return a generated image. Private/LAN endpoint usage should work in this local setup (especially with browser.ssrfPolicy.dangerouslyAllowPrivateNetwork=true).

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING