agents architecture homelab the-hub

"Always Allow" Covers the Whole Domain

Giving a vendor-hosted agent three narrow tools showed that my public gateway answered everyone, and that the approval button I was about to press is granted per domain, not per tool.

December 3, 2026 · 7 min read · Michael Schilling
A glass gate with one small amber keyhole, standing in front of a corridor of open doorways that glow red into the distance

Part 25 of the series: Building The Hub

In March I wrote on this blog that my gateway did not need an auth layer.

It is in part 9, in my own words: “I configured the connector with a direct URL, no auth layer”, and a little further, “If I ever need to share access, I can revisit the auth layer.”

On November 15 I needed to share access. This is the revisit.

Three tools for Overwatch

Last week was about the assistant I put on Meta Muse, with a clearance that excluded MIRS, my contacts database. It has had three names in four weeks: Gideon when this story happened, Scarlett in that post, Overwatch since. I use the name it has today. Eight days after the move I wanted one exception: birthdays. Overwatch should read upcoming birthdays from MIRS, and when Facebook knows a birthday that MIRS does not, fill it in.

MIRS’s MCP server has 88 tools. Overwatch needed three.

So Claude Code built a scoped route on the gateway, with its own API key that opens nothing else:

ToolWhat it may do
mirs_get_upcoming_birthdaysread
mirs_find_contactread names and ids, nothing else
mirs_update_contact_birthdayfill an empty birthday, or add the year to a placeholder

The write is fill-only, and the server enforces it. Any other change is refused, whatever the agent asks for.

Verification on the route looked the way you want it to look: 401 without the key, exactly three tools with it, and no raw SQL tool anywhere on that route.

One thing was already on the list that afternoon as “open, fix later”: the full MIRS route, next to the neat new one, still answered without any key at all.

I will come back to that. So did the evening.

The firewall got there first

Muse could not reach the route at all.

The gateway never saw the requests. They died at the edge, before the tunnel: Cloudflare’s Browser Integrity Check does not like clients that announce themselves as Python-urllib/3.12, which is what Muse’s connector helper did.

The fix was on the agent’s side, a custom User-Agent header in the connector. Nothing changed in Cloudflare. I mention it because it will happen to you: a hosted agent calls your API from somebody else’s script, and your edge decides it is a bot. It is one.

After that, the gateway log showed the whole loop: birthdays read, two contacts looked up by name, two fill-only writes, each after exactly one match. A Facebook friend with no contact in MIRS was reported and not written.

One button, one domain

Every one of those calls needed a tap on “Allow once” in the Muse app. For a morning message that is supposed to arrive by itself, that is a non-starter.

Muse has a second button: “Always allow”.

Before pressing it, I had Claude Code check what it would cover. Not the tool. Not the route. The domain, and its subdomains.

That is what turned “fix later” into “fix before anything else”. Because here is what else lived on that host:

# simplified
curl -s https://gateway.example/mcp/contacts \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
# all 88 tools, no credential

Message history. Writes. Raw SQL.

This was not a new bug. It was the decision from part 9, with a flag name: GATEWAY_SKIP_AUTH=true. I had set it in March so that one connector would work, and every route that was not explicitly strict had answered anonymously ever since. The only protection was a hostname nobody was supposed to know.

A session had already flagged it five days earlier, while documenting something unrelated. There was an open issue, and a decision next to it: connect no new clients until this is fixed.

Then I connected a new client.

So I had built a three-tool key for a front door, in a house with no back wall. “Always allow” would have handed a vendor’s agent the whole street.

Closing it, the same evening

Switching auth on blindly would have broken whatever was quietly relying on it being off. The gateway log showed anonymous clients polling tools/list, one of them once a minute. My guess was a leftover web connector. A guess is not enough to flip a flag on.

First: who is calling, and what does each server see? The gateway learned to log its callers. While in there, Claude Code read how it starts its child servers:

// before, simplified
const env = { ...process.env, ...config.env };
spawn(command, args, { env });

Every server inherited the gateway’s entire environment. The server that fetches the TV schedule could read the database connection string and tokens for services it has nothing to do with. Eighteen variables, secrets among them, handed to every server process.

Now a child gets only the variables its route declares. Checked on the box afterwards from /proc/<pid>/environ: the TV server holds no secrets, and the others hold what they declared.

Second: the gateway fell over. Five restarts that evening, all during verification. The cause was a server that wrote a log line to stdout. Stdout is the JSON-RPC channel, the gateway tried to parse the line, and the whole process died, taking every other route with it. My own test calls triggered it each time. With auth still off, anyone could have done the same with one call.

The fix had two halves. The servers that logged with console.log now log to stderr, and the gateway drops a stdout line that is not JSON-RPC instead of dying on it. A test now feeds it noise before every response.

Third: the anonymous callers were mine. With caller logging in place, the mystery clients turned out to be The Hub’s own agents. They did send a key, in an X-API-Key header that the gateway had never read. Because auth was skipped, nobody had noticed. One more pull request and the gateway accepts that header.

Then the flag:

GATEWAY_SKIP_AUTH=false

Snapshot of the container first. After the restart, five public routes checked, five times 401.

The web connectors I had opened the gateway for in March are retired. If they come back, they come back with a key like everyone else.

What “Always allow” would mean now

It would mean what I thought it meant in the first place. A caller without a credential gets a 401, and Overwatch’s key opens only what was granted to it. A vendor-side permission that is coarser than its button suggests matters a lot less when the fine-grained boundary sits on my side.

So, as far as the gateway goes, the button can be pressed now. I pressed it a week later. The domain holds more than the gateway, and that evening I only checked the gateway, which is why agent traffic will probably get a hostname of its own.

That is the part I had backwards. I was treating the agent’s approval dialog as the access control. It is a convenience setting in somebody else’s product. The access control is whatever my server does when a request arrives without the right key.

That evening, Overwatch was the only agent with a key cut to its job. A week later the gateway learned to give every agent instance a key of its own, with the routes it may open written next to it. Overwatch’s key now opens two: the birthdays, and a place to leave messages for the other agents. That is next week’s post.

For eight months my auth layer was a hostname.

It took an agent that only wanted to wish people a happy birthday to make me replace it.

#agents #architecture #homelab #the-hub