
Closing the Paths In: Isolation, Webhooks, and MCP
Every AI tool you connect to your data opens another path into your network. Most of the security work in my homelab AI setup went into keeping those paths closed.
Nothing listens on the open internet
My local model servers bind to loopback. The Open WebUI tool bridge also listens on loopback, and my private wiki and Proxmox MCP are reachable only over Tailscale, with public Funnel turned off. If a service doesn’t need a public port, it doesn’t get one.
Webhooks deserve the same suspicion
A webhook is an internet-facing endpoint that accepts data from someone else’s server. If you have to receive them:
- Verify the HMAC signature over the raw request body before you parse anything.
- Reject old timestamps, so a captured request can’t be replayed.
- Accept the event, queue it, and return. Do the real work somewhere that isn’t exposed.
- Never feed a webhook payload straight into an agent’s prompt. An issue title or a commit message can carry instructions, and that’s indirect prompt injection.
If you can, relay webhooks through a hosted service and pull them in over an outbound connection, so your lab never opens an inbound port at all.
MCP tools instead of database credentials
The quick way to connect a model to your data is to hand it a connection string. Then the model, and anything that can steer it, can run any query those credentials allow, and the secret sits in its environment.
An MCP server reverses that. The credential stays on the server, and the model sees only named tools with fixed inputs. My Proxmox MCP exposes 8 GET-only tools, uses an audit-only token stored in its own container, and filters its output through allowlists. The model can ask about guests, storage, and backups. It can’t change any of them, because the token can’t.
MCP isn’t automatically safe
A server is only as safe as its code and its tool descriptions. Those descriptions go straight into the model’s context, so a malicious server can hide instructions in them (tool poisoning), and a server can change its tools after you approve it. One study found command injection flaws in 43% of the MCP servers it tested. Read a server’s code before you connect it, give it the narrowest credential that works, mark its tools read-only, and make your client fail closed. My Open WebUI bridge refuses to start if any of its 13 tools isn’t marked read-only.
Next post: why I run open-weight models locally, and what that does and doesn’t fix.
Deep dive
My setup
I separate the services a model can reach from the authority those services hold. My Proxmox MCP runs in its own container and exposes eight GET-only tools for status, guests, storage, backups, snapshots, and firewall information. Its documented output allowlists leave out fields such as guest descriptions and hookscripts.
The backend uses a privilege-separated audit token. The setup checks that its privileges are audit-only, and the application verifies the infrastructure API’s TLS certificate. The MCP service listens on loopback; a private tailnet service provides restricted access from my Mac, with an owner check at the application boundary. These are documented controls, not a fresh live audit.
My Open WebUI bridge has an allowlist of 13 read-only tools. At startup it examines the tools returned by its backends and refuses an allowed tool without a read-only annotation. It does not require every allowlisted tool to be returned. The bridge binds to loopback and requires a bearer key, checked with a constant-time comparison. It is not auto-started; I found no matching launch agent in the inspected user agents. An annotation is a server assertion, so I also review code and backend permissions. These are source-code and configuration findings, not a fresh live check.
Check your own setup
Run these checks only on systems and repositories you own or are authorized to inspect. Command output can reveal internal service names or configuration details, so review it before sharing.
Inspect listeners. On macOS:
lsof -nP -iTCP -sTCP:LISTEN
Record each relevant process, its bind address, and who should reach it. A loopback listener accepts local connections; a listener on a network interface can be reachable beyond the machine. Check firewall, proxy, and private-network policy too. A listener list alone cannot establish the full route or authorization policy.
Find webhook verification code. Set WEBHOOK_SOURCE to the source directory you are authorized to review, then search without modifying files:
rg -n -i 'signature|hmac|timingSafeEqual|compare_digest|timestamp|replay' "$WEBHOOK_SOURCE"
Follow each match from request receipt through verification and dispatch. Confirm that the verifier receives the original body and rejects a missing or invalid signature before processing. Search results are navigation, not proof of a working control. Inspect tests for modified bodies, stale signed timestamps where supported, duplicate deliveries, and missing signatures.
List registered MCP servers. In a Codex installation:
codex mcp list
Use the equivalent server list in your own client for other installations. The list can show server names, enablement, and launch details; it does not establish the backend credential’s effective privileges. Review each server’s available tools in the client, then check the server’s authorization policy and the credential’s actual scopes with the service owner. Avoid copying credentials or connection details into a report.
Webhooks done right
I start with the sender’s documented signing scheme. For GitHub, I calculate HMAC-SHA-256 over the unmodified request body using the configured secret, compare it with the signature header using a constant-time comparison, and reject failures before processing. GitHub documents the exact header and verification sequence in its signature guide.
Next I check freshness and duplicates using the sender’s actual protocol. Stripe includes a signed timestamp and recommends checking its age; its event guidance explains signature verification and replay protection. GitHub’s documented body signature does not include a signed timestamp, so I do not invent one. I track delivery IDs for operational deduplication and recognize that an unsigned delivery header alone is not a cryptographic replay guarantee. I make handlers idempotent and follow each sender’s retry rules.
I allowlist the event types and actions the receiver needs, validate the resulting fields, and reject unexpected requests. Network allowlists can add a layer where the sender publishes maintained ranges; they do not replace signature verification. I keep the secret outside source control and use HTTPS.
After validation, I queue the work and return promptly. Payload content stays untrusted even when the sender’s signature is valid: an issue title can still contain instructions from another person. I do not pass that text to an agent as an instruction or let it authorize an action. GitHub’s webhook practices and OWASP’s REST guidance provide useful checks for event handling and access control.
MCP vs direct DB credentials
| Decision | Direct database credentials | Scoped MCP service |
|---|---|---|
| Credential | A client receives a database credential. | The service holds the backend credential. |
| Allowed operations | The database account’s grants determine available queries and writes. | Named tools expose selected operations; backend grants still set the hard limit. |
| Output | Queries may return any data allowed by the account. | Tool implementation can validate inputs and allowlist returned fields. |
| Review | Review database grants, client behavior, and query access. | Review tool code, descriptions, authentication, network exposure, and backend grants. |
I prefer narrow tools for infrastructure questions because the model can request a specific view without receiving a broad credential. The boundary depends on the implementation: a malicious MCP server can mislabel a tool or return instructions in its output. The MCP security guidance covers scope minimization and other server risks. I enforce read-only access at the backend and review tools before connecting them.