ASADULELAHBOOK A CALL →

Home / Learn

Learn with Asadulelah · Lesson 8

How do I check an AI-built app for security holes before it goes live?

By Asadulelah, a Kerala-based builder of custom software and AI systems for businesses. I build by directing a fleet of AI agents, and this is how I actually do it.

WHO THIS IS FORBuilders shipping AI-written web apps (Django, Next.js, any stack) to real businesses, who need a security pass they can actually run, not a vendor checklist.

WHAT YOU'LL HAVE AT THE ENDA repeatable review: a five-line threat map, nine concrete checks, a rule for what counts as a real finding, and a challenge step that kills false alarms.

Map what the app protects and who it must keep apart, then try to break each wall yourself: log out, switch roles, switch tenants, upload the wrong file, press the money button twice, and search the code and git history for secrets. A finding counts only when you can name the attacker's way in, the boundary it crosses and the damage, so you fix real holes instead of chasing scanner noise.

AI coding agents are fast and confident, and they make the same security mistakes junior developers make, at scale. The most common hole I find in AI-built apps is an AI chat endpoint with no login in front of it, which turns the app into a free proxy to the owner's AI key.

The rule that makes reviews useful

A finding is real only when it names four things: an entry point an attacker controls, a boundary it crosses, the impact, and why the existing protection doesn't stop it. Anything less goes in the report as a hypothesis. "Missing hardening" without a concrete failure scenario is not a finding. This one rule cuts most of the noise that makes people stop reading security reports.

The steps

1. Map the app in five lines first

Who uses it. What is valuable in it (money, personal data, the owner's API keys). The ways in (login, forms, uploads, webhooks, AI endpoints). The walls (shop A vs shop B, owner vs staff, logged out vs logged in). The things that must always be true ("staff never see other branches", "a payment is never recorded twice"). Every later check tests one of these.

2. Prove access control with two users and two tenants

On a local copy, create two users in two different shops or companies. Try every page and every action as: logged out, the wrong role, and the other tenant. Try the direct URL and the direct form submission, not just the button. A long random ID in the URL is not authorization.

3. Check login, invites and sessions

Rate limits on login and reset, secure cookie flags, a disabled user's session dies at once, reset and invite links work exactly once. One lesson from my own work: don't put a second login (like server-level basic auth) in front of an app's own login. The browser re-prompts, the app reads it as a sign-out, and users log in again and again. One sign-in, the app's own, with lockout.

4. Check production settings

Debug off, an exact list of allowed hosts, a content security policy without unsafe-inline. Hiding a page from search engines with noindex is not access control.

5. Look for injection, including in exports

SQL and template injection, shell=True anywhere, and formula injection: any value exported to a spreadsheet that starts with =, +, - or @ can run as a formula on someone's machine.

6. Check file uploads and downloads

Check the file type by its content, not its name. Serve uploaded files through a view that checks permission, never straight from the web server's folder.

7. Search for secrets, and rotate what you find

git log -p | grep -nE "sk-|ghp_|AKIA|BEGIN (RSA|OPENSSH) PRIVATE KEY"

If a key was ever committed, rewriting history is not the fix. Rotate it. And never test a key you found to "see if it works".

8. Test money paths twice

Every money action must be atomic, safe to press twice, and must refuse a stale page. Press the button twice fast. Submit an old form after the record changed.

9. Check the box, not just the app

List what's listening (ss -tlnp), check every web server route, and run the dependency audit (pip-audit, npm audit). Fail closed: if a check can't decide, the answer is no.

10. Challenge every finding before you report it

A fresh agent, with read-only access, tries to kill each finding. Whatever survives gets checked at the sibling pages, because the same mistake is rarely made once. A check that errored is "not assessed", never a quiet pass. High and critical findings block the launch.

The holes I found in my own setup

Three lines I keep from those: a vector that has never been tested is a hypothesis; before believing a verification, force it to fail on purpose; investigating a hole is not the same as fixing it.

Mistakes I made

What I'd do next

If you're launching this week: do steps 2, 7 and 8 today; they find the holes that hurt most. Run the full review before the first real customer, again after any big rebuild, and once a quarter while the app is live. If the app has an AI feature, check first who can call it without logging in.