Schemas and middleware
Every analyzer in this group reads one file and compares it with what a safe file would contain: a schema without the encrypted twin of a PII field, a rules file without an auth test, a middleware matcher that skips a route, an Express route with no guard. No request is sent. The evidence is a file path and the rule that fired.
How this group works
Five artefacts on the left, one loop in the middle. Pick a step to see the scanner read its file, apply one rule and produce a finding.
1Five analyzers, one shape. Each reads a repository file as text, knows what a safe version would contain, and reports the absence. No request is sent and no code is run, so the evidence is always a file path and the rule that fired.
2Prisma schema. A field named like personal data, with no _encrypted, _hash or _hashed twin in the same model. The same rule family finds plaintext secrets, missing tenant columns and payment IDs.
3Drizzle schema. The same checks on pgTable definitions, run on the quoted column name. api_key is a secret name and no protected twin exists.
4Firebase rules. The rules file is the whole server-side access control. allow read, write: if true is matched by pattern: Critical, the highest severity in this group.
5Next.js middleware. The matcher list is compared with the routes found in the repository. A route no matcher reaches skips the auth check, and each such route is a finding.
6Express middleware. Express has no matcher, so each route line is read for a guard among its own arguments. A route with none, on a sensitive path, is a finding.
Scanners in this group
Prisma schema
Four field checks on schema.prisma, and the camelCase spellings that decide what the matcher can see.
Drizzle schema
The same checks on pgTable definitions, run on the database column name, plus the tenant check across tables.
Firebase rules
Open rules, missing auth tests and wildcards, line by line, and one rule evaluated against a request.
Next.js middleware
A matcher laid over the route tree: which API routes fall outside it, and which matcher shapes hide them.
Express middleware
Routes without a guard in their own arguments, weak token checks, and rate limit, header, CORS and tenant checks.
At a glance
| Scanner | What it looks at | What it reports | Severity | Needs |
|---|---|---|---|---|
| Prisma schema analyzer | Every model block in schema.prisma | Secret fields, PII without an encrypted twin, models without tenant_id, payment provider IDs | Low to High | Repository |
| Drizzle schema analyzer | Every pgTable, mysqlTable or sqliteTable call, by column db_name | The same four findings as Prisma | Low to High | Repository |
| Firebase rules analyzer | firestore.rules, storage.rules, database.rules.json | Open rules, allow lines with no auth test, broad wildcards | Medium to Critical | Repository |
| Middleware analyzer | middleware.ts or .js and the Next.js API route list | No middleware, routes outside the matcher, weak token check, bypassable matcher | Low to High | Repository |
| Express middleware analyzer | Express route lines and middleware files | Routes without a guard, weak or missing auth middleware, rate limit, headers, CORS, tenant isolation | Low to High | Repository; Express detected |
Why this class matters
These files decide who can do what before any request arrives, so a mistake in them is a mistake in every request. A schema decides how much a leak exposes. A rules file is the server-side access control for Firebase. A middleware matcher or a route list decides which endpoints are ever asked who is calling.
GitHub (2012). A Rails mass assignment bug let an attacker add his SSH key to the Rails core repository through a field on the model. Comparitech (2020) found 24,000 Android apps with misconfigured Firebase databases leaking emails, passwords and health data. Optus (2022) exposed 9.8 million records through an API endpoint with no authentication, and Peloton (2021) exposed user data through unauthenticated API endpoints.