Dynamic attribute access via getattr()
Low
- Category
- Dangerous Code Execution
- Content
if filters: for key, value in filters.items(): query = query.filter(getattr(self.__model__, key) == value) if offset: query = query.offset(offset)- Confidence
- 81% confidence
- Finding
- This DAO accepts filter keys dynamically and resolves them with getattr(self.__model__, key) without validating that the requested field is permitted. While SQLAlchemy still parameterizes values and prevents classic SQL injection, untrusted callers can query on arbitrary model columns, enabling unauthorized enumeration of sensitive fields or bypass of intended business-level query restrictions.
