I wrote a rate limiter and forgot to plug it in
A security review of The Automated CMO found open AI routes, a GET that spent money, and a limiter that guarded nothing.
Learn · Nov 3, 2026
I had a limiter. I'd written it, committed it, and moved on. Then I ran a security review on one route of The Automated CMO and found out it wasn't connected to anything.
That's the part that stung. A rate limiter that exists but isn't wired in is worse than no limiter, because you stop looking for the gap.
This is the story of one day of review passes on the same app. Three small fixes, one shared lesson.
It's not a dramatic story. Nothing was breached that I know of. But it's the kind of gap that only shows up when someone looks on purpose.
Start with the route that looked harmless
The review began with the guide route. It builds a personalized guide for a module. I'd thought of it as a read. A user asks for the guide, the app shows the guide. But a GET request on that route could trigger AI calls. No limit, nothing stopping a loop. Anyone who could hit that URL could spend my model budget by refreshing. So the first fix was to make the route read-only. It now assembles what already exists and nothing more. The expensive work moved behind an explicit action that I can limit.
Find out the limiter was never plugged in
Earlier in the day I'd added a rate limiter. I felt good about that. Then the review asked a plain question: where is it called? The answer was nowhere. The file existed. The import didn't. Every AI route was still wide open. Here's the thing: I hadn't lied to myself on purpose. I'd done the interesting part, writing the limiter, and skipped the boring part, wiring it into each route. So I wired it into every AI route in one pass and checked each one by hand.
Bound the chat before it talks to the model
The custom-module chat had a similar problem. The route forwarded whatever history and message the client sent, straight through. That means a client could send a huge history, or a very long message, and the model would read all of it. So I capped it: only the last 20 turns survive, and each turn is trimmed to 4,000 characters. The generate step had a second gap. It had no access check of its own. It trusted that the page before it had already checked. Now it checks for itself.
Audit the output across more than one kind of stack
Security wasn't the only pass. I also audited 21 modules across eight kinds of stack, looking for personalization that felt generic. One result was almost funny. The planner listed Claude as an MCP server to install. Claude is the tool the user was already working in. The cause was a link: the module's MCP address pointed at the generic MCP site, so the planner treated it as something to set up. I tightened the personalization so it stops recommending the tool you're sitting in. I also added a guide download while I was in there.
Give the chat the stack it was never told about
The last change was about context. The 'Talk it through' chat started empty. Worse, I'd told the model not to ask about tools. But the user had just picked their tools one step earlier. The chat knew nothing about that choice. Now the selected tools go to the chat route, and the coach speaks first from the user's stack. The conversation starts where the user already is, not at zero.
Ship it in small pieces and check the live app
Each change went out as its own production deploy from main on Vercel. Small commits meant each review finding mapped to one deploy. If one of them had been wrong, I'd have known which. That's the only reason I split them up. One other build failed that day on a separate project. It was a Google Fonts fetch error during npm run build, on a feature branch, while the same commit built fine on another project. I haven't traced it yet, so I'm not going to pretend I know the cause. What I'm keeping from the day is a habit, not a fix. A feature isn't done when the code exists. It's done when something calls it. Next time I add a guard, I'll find the line that uses it before I close the file, and I'll run the audit prompt below on every new AI route.
What broke: Several AI routes in The Automated CMO had no limit. The guide route could trigger AI calls from a plain GET. The rate limiter I'd added earlier wasn't imported by any route, so it protected nothing. The custom-module chat forwarded whatever history and message the client sent, and the generate step had no access check of its own.
The fix: I made the guide route read-only, wired the limiter into every AI route, capped chat history at the last 20 turns with 4,000 characters per turn, and gave the generate step its own access check. Then I shipped each change as a separate production deploy.
Audit every API route in this project that calls an AI model.
For each route, report:
1. The HTTP methods it accepts. Flag any GET that can trigger a model call.
2. Whether a rate limiter is actually called inside the handler. Show the line. Do not count a limiter that is only defined or imported elsewhere.
3. Whether it checks that the user is allowed to use this feature, inside this route, not just on the page before it.
4. What client input goes to the model unbounded: message length, history length, number of items.
Then list every limiter, auth check, or validation helper in the codebase that no route imports. Those are protections that exist on paper only.
Do not change any code yet. Give me a table of routes and gaps, ranked by how much money or data an anonymous caller could burn. Then propose the smallest fix for each.Go deeper
I Ran a Security Audit on My Own Vibe-Coded App and Found the Scary Part Isn't What You'd Expect →
Two chat routes with no rate limiting, pointed straight at a shared API key, and why that's a money problem, not a data-theft problem.
I made the app plan the whole module before it wrote a single step →
Steps built one at a time all sounded alike. Planning around the stack first fixed it.
Get new guides and builds in your inbox
No noise. New artifacts, skills, and lessons when they drop — and early access when agents launch.
Want a full structured path instead of one-off guides?
That's Learn AI with AI — a sequenced course that takes you from zero to building real things, with community and accountability built in.
Check out Learn AI with AI →