Class/Attribute Pollution
Description
Detects unsafe modification of class attributes or object __dict__ using user input.
How to fix
Whitelist allowed attributes before using setattr.
```python
ALLOWED_ATTRS = {"username", "email"}
if key in ALLOWED_ATTRS:
setattr(user, key, value)
```
Learn more: https://shoulder.dev/learn/python/cwe-915/class-pollution
Applies to
Languages
References
Scan for this issue
Detect with Shoulder CLI
npx @shoulderdev/cli trust --rule=python-class-pollution .