SiteShadow
Back to vulnerability library
Detected byStatic analysis

API01 Mass Assignment / Over-Posting

What this means

SiteShadow flagged code that takes client input (JSON/body/form) and binds it directly to an internal model/object without an explicit allowlist of fields.

Why it matters

Attackers can set fields you did not intend to expose (roles, account settings, flags).

Safer examples

1) Explicit allowlist (recommended)

const allowed = (({ name, email }) => ({ name, email }))(req.body);
await updateUser(req.user.id, allowed);

2) Use DTOs / schemas (validation + stripping unknown fields)

const schema = z.object({ name: z.string().min(1), email: z.string().email() }).strict();
const input = schema.parse(req.body);

3) Separate "admin update" vs "self update"

Give admin-only fields a separate endpoint guarded by role checks.

How SiteShadow detects it (high level)

References

---

← Back to Vulnerability Library

Catch this in your code with SiteShadow.

Every released SiteShadow scanner is free, including full project analysis, reports, patterns, dashboard access, and configured organization SSO.