Skip to content
vetkitChecksChangelogDocumentationBlogComparisons

Python mass assignment: setattr with request data

Rule ID: vetkit.py.mass-assignment.request-setattr

Attribute names taken from request data are written onto an object with setattr() or __dict__.update() without an allow-list. Clients can set any field, including is_admin or password (mass assignment).

Last updated:

Suite: Security

python

Attribute names taken from request data are written onto an object with setattr() or __dict__.update() without an allow-list. Clients can set any field, including is_admin or password (mass assignment).

Category: SECURITY · Engine rule severity: WARNING

How to fix it

Validate the body with a schema (pydantic / marshmallow) that lists the writable fields, or check every key against an explicit allow-list before assigning it.

References

Source: packages/engine/rules/sast/python.yml.

Related checks

Check your own repository for this

vetkit runs this rule as part of a repository audit, alongside secret scanning, dependency vulnerabilities, code quality and AI code risk checks. It reads a temporary checkout and never executes your code.

Start with the free Security Quick Scan · See how the platform works

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.