Skip to content

fix(bluebubbles): auto-allowlist serverUrl hostname in SSRF policy - #27648

Closed
lailoo wants to merge 1 commit into
openclaw:mainfrom
lailoo:fix/bluebubbles-ssrf-allowlist-27599
Closed

lailoo wants to merge 1 commit into
openclaw:mainfrom
lailoo:fix/bluebubbles-ssrf-allowlist-27599

Conversation

@lailoo

@lailoo lailoo commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Auto-allowlist the configured serverUrl hostname when fetching BlueBubbles attachments, so localhost and private-IP setups work out of the box without requiring explicit allowPrivateNetwork config.

Problem

After the SSRF security guard was introduced, BlueBubbles attachment downloads from the user's own configured serverUrl (typically http://localhost:1234) are silently blocked because localhost is classified as a private/special-use hostname. Users have no obvious workaround since the allowPrivateNetwork config field exists but is not discoverable.

Closes #27599

Changes

  • extensions/bluebubbles/src/attachments.ts: When allowPrivateNetwork is not explicitly set, extract the hostname from the resolved serverUrl and pass it as allowedHostnames in the SSRF policy. This is more targeted than blanket allowPrivateNetwork: true — only the specific configured server host is trusted.
  • extensions/bluebubbles/src/attachments.test.ts: Updated existing test and added regression test for private IP serverUrl (192.168.1.5).
  • CHANGELOG.md: Added fix entry.

Test plan

  • Existing test updated: verifies allowedHostnames: ["localhost"] is passed when serverUrl is http://localhost:1234 and allowPrivateNetwork is not set.
  • New regression test: verifies allowedHostnames: ["192.168.1.5"] for a private IP serverUrl.
  • Existing allowPrivateNetwork: true test still passes (explicit config takes precedence).
  • All 23 BlueBubbles attachment tests pass.
  • pnpm lint and pnpm format:check clean.

Effect on User Experience

Before: Inbound iMessage attachments silently dropped for any BlueBubbles user running the server on localhost or a private IP (the standard setup). Users had to discover and set allowPrivateNetwork: true manually.

After: Attachment downloads work automatically for the configured serverUrl. Zero config change needed for users. The explicit allowPrivateNetwork escape hatch still works for edge cases.

@greptile-apps

greptile-apps Bot commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Auto-allowlists the configured BlueBubbles serverUrl hostname in the SSRF policy when fetching attachments, so localhost and private-IP setups work out of the box without requiring explicit allowPrivateNetwork config.

  • When allowPrivateNetwork is not explicitly set, the hostname from the constructed API URL is extracted and passed as allowedHostnames in the SSRF policy, which is more targeted than blanket allowPrivateNetwork: true
  • The SSRF guard still enforces redirect-chain checks, so a malicious redirect from the configured server to a different private IP would still be blocked
  • Existing allowPrivateNetwork: true behavior is preserved as the higher-precedence explicit opt-in
  • Test coverage added for both localhost and private IP (192.168.1.5) scenarios

Confidence Score: 5/5

  • This PR is safe to merge — it applies a targeted SSRF allowlist scoped to the user's own configured server hostname, with no blanket private network bypass.
  • The change is minimal and well-scoped: a single helper function and a ternary branch update. The security implications are positive — it uses allowedHostnames (which only bypasses private-network checks for the specific hostname) rather than allowPrivateNetwork: true (which blanket-allows all private addresses). The SSRF guard still enforces redirect-chain checks. Tests cover localhost, private IP, and explicit allowPrivateNetwork precedence cases.
  • No files require special attention.

Last reviewed commit: 263cf03

@bmendonca3

Copy link
Copy Markdown
Contributor

Security review note:

I like the direction here (auto-allowlisting the configured BlueBubbles serverUrl hostname), and the added tests are clear.

Evidence I checked:

  • Diff adds safeExtractHostname() and sets ssrfPolicy.allowedHostnames from parsed URL host.
  • Tests now explicitly allowlist localhost and a private IP host.

Two hardening asks before merge:

  1. Add edge-case tests for hostname canonicalization (localhost., mixed-case hostnames, IPv6 literals like [::1], malformed URLs with userinfo) so allowlisting cannot be bypassed via parse ambiguities.
  2. Rebase and rerun full CI. Current PR state is CONFLICTING/DIRTY and visible checks are mostly label/auto-response, so we do not yet have full gate evidence on this head.

@steipete

Copy link
Copy Markdown
Contributor

Landed on main via 7d9397099b901ec7ff8bbbbf6fc0a11bf981293c.

I carried over the same core fix and shipped it with:

  • changelog entry + reporter thanks
  • co-author trailer (Co-authored-by: damaozi <1811866786@qq.com>)

Closing this PR as already landed direct on main.

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

Labels

channel: bluebubbles Channel integration: bluebubbles size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BlueBubbles: SSRF guard blocks attachment downloads from configured localhost serverUrl

3 participants