BETA Shoulder is in beta — Findings may sometimes be wrong. Your feedback shapes what we fix next. Share feedback

Prisma Missing Input Validation

Description

Passing req.body directly to Prisma where/data allows users to filter by unauthorized fields and bypass access controls.

What Shoulder detects

Prisma {operation} uses unvalidated user input. Validate and whitelist fields before passing to Prisma.

How to fix

Validate and whitelist fields with Zod before Prisma queries.

```typescript
import { z } from 'zod';

const getUsersInput = z.object({
  role: z.enum(['user', 'moderator']).optional(),
  status: z.enum(['active', 'inactive']).optional()
});

async function getUsers(req: Request) {
  const input = getUsersInput.parse(req.query);
  return await prisma.user.findMany({ where: input });
}
```

Learn more: https://shoulder.dev/learn/typescript/cwe-20/prisma-missing-input-validation

Applies to

Frameworks

prisma

References

Scan for this issue

Detect with Shoulder CLI
npx @shoulderdev/cli trust --rule=prisma-missing-input-validation .

Real-world examples

Known CVEs in the Improper Input Validation vulnerability class that this rule helps detect.

Related rules