A Practical Security Audit Toolkit for Small SaaS Teams
Before launch, a founder wants two answers: can a stranger get in, and can one customer see another customer’s data?
You do not need a big formal security audit to answer them. You need a repeatable check: find the obvious risks, fix the dangerous ones, and know where the free tools stop helping.
In October 2026 I ran this whole checklist, step by step, on a job-alert SaaS I build. This page says what really happened. The Technical tab has the commands and the details.
You don’t need to run any of these tools yourself. I run them, sort the real risks from the noise, and hand you a short list of what to fix first.
What the audit is testing for
Every check below answers one of twelve questions. Here they are in short. The full version, with examples, is in understanding security in your SaaS.
- Sign-in: is this person who they say they are?
- Permissions: can they only see and change their own things?
- Input: is what they send checked for shape and size?
- Money and app rules: can someone get paid features free, or cheat a trial?
- Abuse and limits: can someone call the app too often, or run up your bills?
- Secrets: are the app’s own passwords and keys kept out of the code?
- Settings: is the live site switched on safely?
- Outside code: do the packages the app uses have known holes?
- Automatic jobs: what runs by itself, and what can it reach?
- Errors: when something breaks, does the app say no?
- Logs and alerts: would you notice an attack?
- Tests: does each fix stay fixed?
The first five are where the worst holes hide, and tools barely see them. The tools in steps 1 to 6 mostly cover 6 to 9. The checks by hand cover the rest.
Where this fits in how I review code
This audit is one layer. It sits on top of the reviews that run all the time.
- Every change: two reviews, one for bugs and one for structure. The tool is my PR review skill.
- Every week: a full read of the whole app, with a security pass. The tool is my weekly review skill. It found five billing problems and one door into the app with no limit on how often it can be called, before this audit started.
- Every month: the free tools in steps 1 to 5 below.
- By hand, line by line: logins, payments, permissions and anything that touches customer data. I also redo it every time the app gets a new way to change data or money. That is the “checks only a person can do” part below.
How much I read by hand on a fast first version versus a live product is in how I review AI-written code.
Step 1: Check the outside code the app uses
Every app is built on hundreds of free code packages written by other people. Sometimes one of them has a known security hole. A tool can list those for you in seconds.
What happened: the tool found 11 holes, one marked “critical”. The run before had found none. The app’s code had not changed. New holes were found in old packages.
What to do:
- Read why each one is marked “critical”. The critical one here only mattered if the app was built a certain way. This one was not. I fixed it anyway because it was cheap.
- Run the safe fix command, not the forced one. It cleared most of them. The rest were in developer-only tools, or needed a change that would break another part.
- Run this every month. Clean last month does not mean clean now.
Step 2: Look for passwords left in the code
Developers sometimes save a password or key into the code by mistake. A tool can search every saved version for them.
What happened: 5 matches, none real. They were ordinary words in saved job posts that looked like keys to the tool.
What to do: search the saved history, not the whole folder. Searching the folder read 12.8 GB of temporary files and gave 1,287 false alarms.
Step 3: Scan the code for risky patterns
A tool reads the code looking for known bad habits, like trusting user text too much.
What happened: one match, in a backup script that never runs on the live site. Harmless.
Step 4: Poke the running website
A tool visits the website the way a stranger would and checks for weak settings.
What happened: 0 failures, 9 warnings. Only one was worth a look, and it was minor. The rest did not apply to this app.
What to do: test the real website, not the developer’s laptop copy. The laptop copy turns on extra settings that help building but look like holes to the tool.
Step 5: Check servers and containers
If you run your own servers, a tool can check how they are set up.
What happened: this app runs on a hosting service, so there was nothing to check. The tool only repeated step 1.
What to do: skip this step if you do not run your own servers.
Step 6: Check the automatic jobs
Most apps have jobs that run by themselves, like nightly updates or deploys. Most checklists barely mention them.
What happened: two jobs were broken. One had failed every night, 42 times in a row. Nobody had noticed, because nobody used them. I removed both.
What to do: first ask “does this job even run?” A broken job that can reach your live data is a risk with no benefit.
The checks only a person can do
Tools do not know your app’s rules. They do not know that one customer must never see another customer’s data. This part found the most real issues.
I did it with Claude, using checklists I wrote. Claude ran the checks. I decided what mattered.
Can a stranger get in? I tried all 65 doors into the app without signing in. Every one said no. None leaked data.
Can one customer see another customer’s data? I made two fake customers and had one try 8 ways to read, change or delete the other’s things. It failed all 8 times, which is the right answer. This test now runs every time code goes to the shared copy.
Can someone send a huge amount of text? Yes, they could. Text boxes had no size limit. I added limits. A job description can now be up to 50,000 characters, about 25 pages.
Can someone fake a payment message? I sent a fake one. The app refused it. Five billing problems found in an earlier review were already fixed.
Is the call limit shared? A limit on how often someone can call the app only works if every server shares it. If each server keeps its own count, a caller can dodge it by spreading calls across servers. Here, each server kept its own count. The count now lives in the database, so every server shares it. Check where yours lives.
Can a normal customer open the admin pages? No. Every admin page checks for itself, not only the outer frame. The background jobs each need a secret key, and refuse when the key is missing.
Are the live settings safe? Error pages show no code. The site’s source code maps are not public. Also check one guard that is easy to miss: the one that stops the test site from writing to the live database. It is a one-line setting.
Who might attack, and what would they want? I wrote it down as a short table: strangers, other customers, people who want paid features free, bots running up AI costs, and someone who gets into an admin’s email. For each one: what should stop them. Any weak answer is your next fix.
One thing that was not a security hole but was broken: a chat app connection could never receive messages, because the sign-in gate blocked it. It failed safe, so nothing leaked, but the feature did not work. Tools never flag this kind of thing. Reading the routes did.
Why an automatic test suite matters
A security check finds the holes. Tests keep them closed.
A test is a small program that checks one thing still works. For example, “a customer cannot open another customer’s draft”. If someone breaks it by mistake later, the test fails and the change is stopped.
This app has about 1,600 quick tests and 56 slower ones that click through the real website. The quick ones run in about 12 seconds every time code goes to the shared copy. The slow ones take about 9 minutes and run before big releases.
When to add a test:
- every security fix
- every bug, before it is fixed
- every new feature that touches money or customer data
Keep the slow tests current: a test that is not run often falls behind the screens it checks. Run the quick tests on every change and the slow ones on a schedule, and update a test in the same change as the screen.
The plan I would follow again
- Check outside code. Once a month.
- Search saved history for passwords.
- Scan the code for risky patterns.
- Poke the real website, not the laptop copy.
- Check servers only if you run your own.
- Check the automatic jobs actually run.
- By hand: strangers, other customers, text size, fake payments, admin pages, live settings.
- Write down who might attack and what stops them.
- Add a test for every fix.
Write every result down as you go. My notes from this run became this page.
If your app is growing, the SaaS scaling readiness checklist covers what to check next. If one database holds every customer, row-level security makes the database itself refuse the wrong rows.
The short version
- Free tools are worth running. They found 11 problems in outside code the app uses. Most were not a real risk to this app, and knowing that took a person reading them.
- The real fixes came from checking the app’s own rules by hand: who can see what, how big a text box can be, which background jobs were broken.
- Every fix now has an automatic test, so it cannot quietly break again.
- Run the free tools monthly, the fast tests on every change, and the checks by hand every time the app gets a new way to change data or money.
Tell me what your app is built with and I’ll tell you which of the twelve areas to check first.
Which of the twelve areas has your app never been checked for?
This is the toolkit as I actually ran it in October 2026 on a job-alert SaaS I build: a Next.js app on Postgres, with hosted sign-in, error monitoring, paid plans with billing webhooks, and a separate dev site. Every step below was run by hand, in order, and the notes say what really happened, including where the usual advice was wrong.
The split still holds. Tools give you a baseline. The dangerous bugs live in auth, tenant boundaries, money and admin routes, and those need someone who knows the product rules.
What each step tests for
The steps map to twelve areas. What each area is, the attack types inside it and the OWASP Top 10:2025 mapping are in understanding security in your SaaS.
| Step | Area | OWASP 2025 |
|---|---|---|
| 1. Dependency scanning | Supply chain | A03 |
| 2. Secret scanning | Secrets | A04, A02 |
| 3. Static code scanning | Input handling (patterns only) | A05 |
| 4. Dynamic scanning | Configuration, headers | A02 |
| 5. Container and infra | Configuration, supply chain | A02, A03 |
| 6. CI/CD review | Pipelines and scheduled jobs | A03, A08 |
| Manual layer | Authentication, access control, input limits, business logic, abuse limits, failure handling, threat model | A07, A01, A05, A06, A10 |
Logging and alerting (A09) is the one area this run did not test on its own.
Where this sits in my review routine
| When | What runs | What it covers |
|---|---|---|
| Every change | PR review skill | Diff only: code pass for bugs, then architecture pass, then specialists picked by which files changed |
| Every week | Weekly review skill | Whole files, every slice, plus a security pass that reads every UPDATE and DELETE |
| Every month | Scanners, steps 1 to 5 below | Dependencies, secrets, code patterns, the deployed app, containers |
| By hand | Me, with Claude running requests and greps | Auth, tenant boundaries, money, admin routes. Redone whenever the product gets a new way to change data or money |
The weekly review had already found the five billing bugs and the endpoint with no rate limit before this run. The manual layer below starts from those results instead of from zero. For how deep I read by hand on an MVP versus production code, see how I review AI-written code.
The tools, and how I ran them
| Tool | How I ran it | Time | What it found |
|---|---|---|---|
npm audit | installed with Node | 3s | 11 vulns (1 critical, 6 high). Clean on the run before. |
osv-scanner | Docker, no install | 21s | Same set as npm audit |
Gitleaks (git) | installed | 3s | 5 hits, all false |
Semgrep p/owasp-top-ten | installed | 21s | 1 harmless hit in a backup shell script |
| OWASP ZAP baseline | Docker | ~4m | 0 fail, 9 warnings |
Trivy fs | Docker, no install | 1m20s | 1 high, the same leftover as npm audit |
| CodeQL, Dependency-Check | not run | — | skipped for a single-language Node app |
Three of the scanners never got installed. Docker runs them:
docker run --rm -v "$PWD:/src" ghcr.io/google/osv-scanner scan -r /src
docker run --rm -v "$PWD:/src" aquasec/trivy fs --skip-dirs node_modules --skip-dirs .next /src
docker run -t zaproxy/zap-stable zap-baseline.py -t https://dev.example.com
The first Trivy run downloads about 130 MB of vulnerability data. After that it is quick.
1. Dependency scanning
npm audit
npm audit fix # no --force
npm test
npm audit found 11 issues. npm audit fix without --force cleared 3, including the critical one. The 8 left were dev-only tools (the test runner and a glob helper) and one validation library pinned inside a hosting vendor’s SDK. Fixing that last one needed --force, which would have broken the SDK, so I left it and wrote down why.
A “critical” is not the same as exploitable. The critical was a middleware bypass in our error-monitoring SDK. The advisory listed four conditions, all required: the tunnel route turned on, a webpack build, a route under the tunnel path or a dynamic root segment, and auth only in middleware. We had the tunnel on, but our build does not use webpack and has no route under it. Not reachable. I upgraded anyway because it was cheap, but the panic level was wrong.
Read the advisory’s conditions before you rank a finding. The scanner only knows the package version.
osv-scanner returned the same list. For a Node-only app with one lockfile it adds little. It earns its place in mixed-language repos.
Re-run often. The run before was clean. This one found 11 new issues and no code had changed. New advisories land on old packages every week.
2. Secret scanning
gitleaks git .
Five hits, all false: ordinary words in saved job posts, and empty environment variable names in a doc.
Do not run gitleaks dir . on a working repo without excludes. I tried it. It read 12.8 GB in 2 minutes 41 seconds and reported 1,287 hits. Every one was noise: the .next build cache, node_modules, 14 git worktrees under .claude/worktrees, and .env files that git already ignores. Scan git history, which is what gets shared. If you scan the folder, exclude build output, dependencies and worktrees first.
If a real secret turns up, deleting it is not enough. Rotate it, check whether it was used, and assume the history has been cloned.
3. Static code scanning
semgrep scan --config p/owasp-top-ten
One warning, in a shell prompt script inside a config backup folder. Not shipped, not reachable. Two files failed to parse, which is normal for very new syntax.
Upgrading Semgrep does not change results much. The rules come from the online rule pack, not the binary.
I skipped CodeQL and eslint-plugin-security this round. Semgrep plus the code review below covered the same ground for this app.
4. Dynamic scanning with ZAP
docker run -t zaproxy/zap-stable zap-baseline.py -t https://dev.example.com
Scan a deployed build, not your local dev server. A scan against npm run dev flags unsafe-eval in the CSP and an error-disclosure page. Both exist only in development mode: the dev server adds unsafe-eval for hot reload. The deployed dev site, built for production, had neither. Scanning local dev gives you dev-only noise.
The deployed scan: 0 fail, 59 pass, 9 warnings. Only one was worth a look:
- CSP
script-src 'unsafe-inline'. Minor. The fix is nonces or hashes.
The rest were not real problems here:
- cache-control notes on static files
- no Subresource Integrity on the sign-in provider’s scripts, which load from the provider’s own domain and change version without notice, so pinning a hash is not practical
- COEP missing, which this app does not need
Access-Control-Allow-Origin: *on public static files- anti-CSRF token missing on the login page, a false positive for a hosted sign-in flow
- odd 404s like
/%2Fimage.webp&w=96, which was ZAP misreading an imagesrcset, not a broken link
While there, I checked every dangerouslySetInnerHTML in the code. Two uses, both safe: JSON-LD that escapes <, and fixed CSS text in an email template.
The WSL tip most guides give is backwards for current Docker Desktop. When I did scan locally, host.docker.internal reached the app and the WSL eth0 IP did not. Test with a one-line curl container first:
docker run --rm curlimages/curl:latest -I http://host.docker.internal:3000
5. Container and infrastructure scanning
trivy fs .
trivy config .
Trivy found 0 config files to check and one high: the same validation library left over from step 1. This app ships no Dockerfile, Terraform or Kubernetes files, so Trivy only repeated npm audit.
If you ship images or infra code, keep this step. If you deploy to a platform from source, it is mostly a second opinion on your lockfile.
6. CI/CD review
Most checklists tuck this into a footnote with two grep commands for unpinned actions. It deserves its own step, and the first question is not “are the actions pinned?” It is “does this pipeline even run?”
gh run list --workflow <file> --limit 50
gh secret list
Our actions were already pinned to commit SHAs. But the run history showed:
- a production migration job that had run once, and failed, a month and a half earlier
- a nightly dev reseed job that had failed all 42 of its runs
The secrets both jobs needed had never been set on GitHub. Nobody used either job. I removed both. Remove any secret that nothing reads, too.
A broken job with deploy rights is worse than no job. Check what runs, what fails, and what has access, then pin what is left.
The manual layer
Scanners do not know your product rules. This is where I spent most of the time. I did these checks with Claude Code: my own agency-security-review skill holds the checklist, and the weekly full-codebase review I run has a security pass that reads every mutation. Claude ran the requests and the greps; I made every call on what mattered. Here is what each check looked like in practice.
Who can do what
Most guides list questions here. These are the methods:
- Call every API signed out. I sent a plain GET to all 65 API routes on the dev site with no cookie. 61 returned 401, 3 POST-only public routes returned 405, 1 was slow and then returned 401. None returned data.
- Try a fake test-login cookie on a deployed site. Our test login only works when the app is not in production mode and the database is on localhost. On the dev site it was refused.
- Check the local-only login helper. It returns 404 unless the database is local.
- Check every query that takes a row ID. Each one also filters by
account_idoruser_id. The weekly review had already read every UPDATE and DELETE and found the owner filter on all of them.
Changing IDs to reach another account
A grep proves the filter is written. A test proves it works. I run a live test against a real local database:
- create two fake members, A and B
- give B a search, a found job, a draft, a capture and a proposal
- as A, try 8 moves by ID: change, delete and post results into B’s search, change the found job, read the draft, write a draft from B’s job, analyze the capture, and mark or delete the proposal
- check B’s rows are unchanged, then delete both fake members
8 of 8 checks passed, and the real rows in the database were untouched. That test was not in the default test run, so it never ran on push. It now runs before every push to main and dev. It takes about 2 seconds.
Cross-site requests, sessions, cookies and headers
- The cross-site request guard runs first in the middleware. It has 20 unit tests in the default suite.
- Cookie flags and security headers (
HttpOnly,Secure,SameSite,frame-ancestors, HSTS,nosniff) all passed the ZAP scan on the deployed site. - Run the browser tests with the console open. They catch CSP mistakes a header scan misses, like an invalid wildcard host in
connect-srcor a missingworker-srcthat blocks a vendor’s workers.
Rate limits and input size
- The weekly review found an endpoint with no rate limit. Fixed.
- It also found every free-text field with no maximum length. A user could post a “job description” of any size. I added caps at the validation layer: 500 characters for short fields, 10,000 for medium, 50,000 for long, 2,000 for URLs, 200,000 for raw page captures. Each cap has tests.
- Check where rate limits live. If each server keeps its own count in memory, the limits are not shared across instances and a caller can dodge them. Ours were in memory at audit time. They now live in a Postgres table, one row per bucket, counted with one atomic upsert, so every instance and every restart shares the count.
Payments and billing
- The weekly review found five billing problems: steps not in one transaction, the customer not created first, a double-subscription path, more than one trial per customer, and a stale subscription read. All five were fixed before this run.
- An unsigned POST to the billing webhook on the dev site was refused with 400.
- 51 billing unit tests pass, plus 3 tests that replay real webhook events against a local database.
Admin and internal routes
List every route the middleware lets through without a session, then read each one.
- Admin pages. Eight pages, each calls the admin check itself. A check in the admin layout is not enough: in current Next.js a layout does not stop the pages under it from running, and it does not re-run on client navigation.
- Admin APIs. Five routes, each returns 403 for a non-admin. No server actions anywhere, so no hidden entry points.
- Cron routes. Five, each needs a Bearer secret, compared in constant time, and refuses when the secret is unset. The job that runs every minute from an outside scheduler has its own secret, so a leak there cannot run the others.
- Local login helper. 404 unless test auth is on and the database is on localhost. Test admins exist only outside production.
- Webhooks. The billing webhook is on the public list and checks its signature. The chat app webhook was not on the public list at all, so the middleware refused every message from the chat app: 401 on the dev site, 403 on production. It failed closed, so no hole, but the chat link feature could never work. A scanner would not find this. Reading the public route list against the route folders did.
Production config
- Source maps return 403 on both sites; they are deleted after upload to the error monitor.
x-powered-byis off. - Bad JSON and unknown pages return
{"error":"Not found"}, no stack traces. - The hosting CLI’s env list (names only) showed no test-auth flag and no extra admin list in any environment, and an email allowlist on the dev site.
- Set a database host guard. A check that the database host matches the environment. Without it, a dev deployment pointed at the production database starts without complaint. One env var per environment.
- Watch dev-site crawling. A dev site built in production mode serves the production
robots.txt. A canonical link to production and blocked signed-in pages keep the risk small. - Trim CSP
connect-srcto the hosts the browser actually calls.
Threat model
Keep it to one table: who, what they want, what should stop them.
| Who | Wants | What should stop them |
|---|---|---|
| Stranger | member data | every API refuses signed out |
| Member | another member’s data | owner filter on every query; cross-account test on push |
| Member | paid features free | signed webhooks; one trial and one subscription per customer |
| Member or bot | run up AI and email cost | text caps; rate limits in a shared store |
| Thief with a session | act as a member | step-up check when the network changes |
| Leaked cron secret | run jobs | one secret per busy job; jobs only act on due rows; rotate on leak |
| Someone in an admin’s email | full admin | two-step sign-in on every admin account |
| Bad package | run code on the server | monthly audit; a written reason for any leftover |
| A mistake | dev writes to the prod database | separate env vars; a database host guard |
Any row where your answer is weak is your next fix.
The test suite is part of security
Every fix above would quietly break again one day if nothing checked it. A security review finds the holes. The test suite keeps them closed.
What I run, and why each kind exists:
| Kind | What it checks | Count here | When it runs |
|---|---|---|---|
| Unit | One function: a validator, a permission rule, a price calculation | ~1,560 with route tests | Every push to main or dev |
| Route | One API route with the database faked: right status, right errors | (in the line above) | Every push to main or dev |
| Live database | Real queries on a real local Postgres: tenant isolation, billing, account deletion | a few files | Cross-account test on every push; the rest in the full run |
| Browser | The real app in a real browser: pages load, buttons work, phone sizes fit | 56 | Full run before big releases |
The unit and route tests take about 12 seconds, so they run before every push to the shared branches and a failure blocks the push. The full run builds the app, starts it, and runs everything, including the browser tests. It takes about 9 minutes, so it runs before big releases, not on every push.
When to add a test:
- Every security fix gets one. The text caps, the cross-account test and the webhook signature check all have tests that fail if someone removes the fix.
- Every bug gets one before the fix. Write the test, watch it fail, then fix.
- Every new route gets a route test for signed out, wrong account and bad input.
- Every rule about money or access gets a unit test, because those are the rules scanners cannot see.
Browser tests that only run before releases drift behind the UI. Update each test in the same commit as the screen it covers, run the fast tests on every push, and run the full suite on a schedule so drift shows up in days, not weeks.
The checklist, as I would run it again
# 1. Dependencies
npm audit
npm audit fix # no --force; read the advisory for anything left
npm test
# 2. Secrets: git history only
gitleaks git .
# 3. Code patterns
semgrep scan --config p/owasp-top-ten
# 4. Running app: a deployed build, not local dev
docker run -t zaproxy/zap-stable zap-baseline.py -t https://dev.example.com
# 5. Containers and infra: only if you ship them
docker run --rm -v "$PWD:/src" aquasec/trivy fs --skip-dirs node_modules --skip-dirs .next /src
# 6. CI/CD: does it run, does it fail, what can it reach
gh run list --limit 50
gh secret list
Then the manual layer: signed-out calls to every route, a two-account ID test, a webhook signature test, text size limits, rate limits, admin routes, production config, threat model.
Write every result into one notes file as you go. That file became this article.
The bottom line
Automated tools tell you where the common risks are. Most of what they flagged here was noise or not reachable, and knowing that took reading, not running.
The real fixes came from the manual layer and from tests that keep each fix in place. Run the scanners monthly. Run the fast tests on every push. Do the manual review every time the product grows a new way to change data or money.
More Posts
All posts
November 25, 2026
Why Your App Went Offline on Vercel's Free Plan (and How to Stay Under the Limits)
Vercel's free plan pauses every site on the account when one monthly limit runs out. What the limits mean in plain words, what uses them up, and the fixes, from a real case.
November 24, 2026
Why Your Project Starts With a Small Paid Step: Requirements and an Estimate Before the Build
A price given before the work is measured is a guess, and someone pays for it later. What a small paid first step gets you: written decisions, a cost range and a time range, and the choice to stop there.