Skip to content

feat(mcp): URL allowlisting and SSRF defense on search and paid call (closes #404, closes #407) - #449

Open
sparkysolutions10-pixel wants to merge 2 commits into
Divinity-Labs:mainfrom
sparkysolutions10-pixel:feat/mcp-url-allowlist-and-ssrf-defense-404-407
Open

sparkysolutions10-pixel wants to merge 2 commits into
Divinity-Labs:mainfrom
sparkysolutions10-pixel:feat/mcp-url-allowlist-and-ssrf-defense-404-407

Conversation

@sparkysolutions10-pixel

@sparkysolutions10-pixel sparkysolutions10-pixel commented Oct 17, 2026 •

Copy link
Copy Markdown

Summary

Addresses and resolves issues #404 and #407 by introducing strict host allowlisting, URL scheme validation, and post-DNS SSRF defense with redirect inspection for the Bazaar MCP server.

Key Changes

  1. Host Allowlist for paid_call (paid_call will pay whatever URL the agent names #404):

    • Configurable host allowlist (�llowedHosts, �llowedPaymentHosts, env MCP_ALLOWED_HOSTS).
    • The allowlist is strictly driven by operator configuration, not tool arguments.
    • Default pays nobody: If unconfigured, the default configuration pays nothing ([]).
    • Refuses before network contact: Any un-allowlisted host is refused immediately with structured error code ERR_HOST_NOT_ALLOWED, explicitly naming the host in the error reason.
    • Near-miss spoofing defense: Prevents domain confusion and near-misses (e.g.
      otstellar.org, stellar.org.attacker.com).
  2. SSRF Defense & URL Validation for �azaar_search (bazaar_search will fetch any URL it is given #407):

    • Rejects non-HTTP schemes (e.g. ile:, tp:, gopher:) with ERR_INVALID_URL.
    • Blocks requests to private, loopback, link-local, and cloud metadata addresses (e.g. 127.0.0.1, 169.254.169.254, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 100.64.0.0/10, ::1).
    • Post-DNS resolution check: Resolves hostnames and checks all resolved IP addresses, effectively preventing DNS rebinding attacks to internal infrastructure.
    • Safe redirect inspection: Manual redirect inspection up to max redirect bounds; any redirect pointing to a private, loopback, metadata, or forbidden destination is blocked with ERR_PRIVATE_ADDRESS_REFUSED.
  3. New MCP Error Codes:

    • Added ERR_HOST_NOT_ALLOWED, ERR_PRIVATE_ADDRESS_REFUSED, and ERR_INVALID_URL to MCP_ERROR_CODES in src/mcp/codes.ts.
  4. Changeset & Tests:

    • Added .changeset/mcp-url-allowlist-and-ssrf-defense.md.
    • Comprehensive Vitest test suite in ests/mcp.test.ts (12 tests) verifying:
      • Default configuration pays nobody
      • Allowed hosts succeed
      • Near-miss hosts are refused
      • Non-HTTP schemes are rejected
      • Private IP literals are blocked
      • Hostnames resolving to private addresses are blocked post-DNS
      • Redirects to private destinations are intercepted and refused

Closes #404
Closes #407

This was referenced Oct 18, 2026

@Miracle656 Miracle656 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Changes requested: one issue per PR, and only issues assigned to you

This is a process requirement, applied to all 23 of your open PRs in this repo. It is not a judgement about the code, which I have not been able to review — and that is the first half of the problem.

The bundling

Across your open PRs, 150 distinct issues are claimed. This one claims several. #483 claims 22, #481 claims 20, #477 claims 20, #474 claims 20.

A PR that closes twenty issues cannot be reviewed. Each of those issues has its own acceptance criteria — typically five — so twenty issues is a hundred separate things to verify in one diff, and if any one of them is wrong the whole PR is blocked while it is fixed. Every batch I published says the issues are deliberately independent so they can be worked in parallel, by different people, without colliding. Bundling them removes exactly that property.

The assignments

135 of the 150 issues claimed are assigned to other contributors — 67 different people.

This PR is an example: it names issues currently assigned to other contributors who are working on them now. Several have open PRs of their own. If this merged as it stands, those people would have done the work and received nothing for it, and I would have no way to tell the two efforts apart.

I am not assuming anything about why. Assignments change, Drips and GitHub can disagree, and a wide-ranging branch picks up issue numbers easily. But the effect on the people holding those assignments is the same regardless of intent, which is why I have to act on it.

What I need

  • One issue per PR. The issue number in the title, its acceptance criteria met, and nothing else in the diff.
  • Only issues assigned to you, or unassigned ones you have claimed through Drips. If an issue is assigned to someone else, it is theirs.
  • Re-open the work that meets both conditions as individual PRs. I will review them in the order they arrive and at the same pace as everyone else's.

Nothing is being closed. These stay open and are yours to re-cut, withdraw or split as you choose.

Two things worth knowing before you re-cut

Some of this has already landed. #488 (SSRF guard for bazaar_search) and #487 (the paid_call host allow-list) cover the same ground as your #449; #486 covers the MCP README. Check current main before rebuilding something that is already there.

main has moved a long way today — #306, #309, #252, #256, #355, #381, #390, #402, #476, #488 and more. Cut from current main, not from where these branches started.

If you believe an issue named here is genuinely yours, say which and I will check the assignment myself — I would rather be corrected than have someone lose work.

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.

bazaar_search will fetch any URL it is given paid_call will pay whatever URL the agent names

2 participants