Dev.to Security 🔐 Cybersecurity 👁 0 📖 4 min read

Our AI couldn't approve posts. It could still pick which ones skip review

Three weeks ago we wrote about the MCP server behind Echoly, our social post scheduler. Its central rule: an AI app can add posts and cancel posts, but it cannot approve them. There is no approve_post tool, on purpose.

Three weeks ago we wrote about the MCP server behind Echoly, our social post scheduler. Its central rule: an AI app can add posts and cancel posts, but it cannot approve them. There is no approve_post tool, on purpose.

A reader, RecallRun, left a comment on the dev.to copy of that post. They had been testing the same idea: 33 hand-written tool calls against a six-tool registry. A denylist of tool names let 25 of 29 bad calls through, and about a third of those used harmless-sounding tools with hostile arguments. So they asked two questions about our arguments.

The first one we could answer straight away. The second one found a real gap.

Question 1: do the checks live in the arguments?

Yes. Every post lookup is scoped to the workspace the OAuth grant belongs to, in the same SQL query:

const p = await env.DB.prepare(
  "SELECT p.* FROM posts p JOIN brands b ON b.id = p.brand_id WHERE p.id = ? AND b.workspace_id = ?",
).bind(id, wsId).first<Post>();
if (!p) throw new ApiError(404, "post_not_found", "Post not found");

cancel_post and get_post both go through it, so a post id from someone else's workspace is simply "not found". create_post looks the brand up in the same workspace and can only target accounts already connected to that brand. An unknown brand or handle is rejected, never created.

Question 2: the auto-approval line

Our server's instructions to the model said:

create_post adds a post. It waits for the person's approval in Echoly unless the brand uses automatic approval.

Automatic approval is a per-brand setting on paid plans. Posts that pass a fact check, repeat check, daily caps, blocked words and an undo window are scheduled without a person. We had treated it as the person's choice about a brand, which it is.

RecallRun's point: if a workspace has two brands and only one auto-approves, the model choosing the brand is effectively choosing whether a human sees the post. brand is just another argument to create_post, and the model fills it in.

That makes "the AI can't approve" true and not the whole story. The AI couldn't move a post to scheduled. But it could route a post down the path where nobody looks at it. An AI app reads web pages, emails and documents, and a paragraph aimed at the model ("post this for the other brand") would have been enough.

Why we missed it

We thought of approval as an action, and removed the action. Routing between two paths with different trust levels is also a decision, and we left that one with the model.

The general lesson: when you take a capability away from an agent, look for every argument that selects between paths with different checks. Removing the tool is not enough if a parameter can choose the unchecked path.

The fix

RecallRun suggested two options: require the brand to be named by the user, or don't expose auto-approve brands over MCP at all.

The first is hard to enforce from the server's side: an MCP server only sees the tool call, not what the person typed. The second hides brands people legitimately want to post to. So we did a third thing: automatic approval for posts from AI apps is now its own opt-in per brand, off by default.

The guard sits with the others:

// An AI choosing an auto-approved brand would be choosing whether a person sees the post.
if (c.fromAiApp && !c.aiAppAuto) out.push("Added by an AI app: this brand auto-approves only posts from you, the editor and the API (turn on AI app posts in the brand's settings)");

Where the post came from is recorded by the server from how the call was authenticated, never from the tool's arguments. An OAuth app's posts are stored as mcp:<app name>, an API key used over MCP as mcp:

export const isAiAppPost = (p: Pick<Post, "created_by">): boolean => /^mcp(:|$)/.test(p.created_by);

A few things changed with it:

  • Brand settings have a new checkbox, "Auto-approve posts from AI apps too". Posts from the editor and from scripts using the API follow the brand's setting as before.
  • The consent page only warns about brands where this switch is on, since those are the only ones where an AI app's post can skip review.
  • list_brands now returns ai_app_posts: "auto" | "manual" per brand, so the model can tell the person up front whether its post will wait.
  • Existing brands: the migration turned the switch on only for brands that had already had AI app posts approved automatically, so nothing that worked yesterday broke. Every other brand starts with it off.

The comment came in on 21 November. The fix shipped on 24 November, the day we replied.

What we'd tell someone building the same thing

  • Leaving out the dangerous tool is the right start. Then list every argument that picks between paths with different checks, and treat each one as a decision the model is making.
  • Record where an action came from on the server, from the credential, not from anything the caller sends.
  • Make the stricter path the default for agents, and let the person opt in per scope.
  • Publish your design. A stranger with a test harness found this before any user did.

Thanks to RecallRun for the careful read.

Try it

Echoly has a free plan, and the MCP connector works on every plan, Free included. Setup for Claude, ChatGPT, Claude Code, Cursor and VS Code: https://echoly.2cstudio.app/docs/mcp.

Written by 2C Studio, a small studio. We also build MCP servers for other teams' APIs: 2cstudio.app/services.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.