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
- 86% confidence
- Finding
- The list() method applies getattr(self.__model__, key) using filter keys supplied by callers. While this is not classic SQL injection because SQLAlchemy parameterizes values, untrusted keys can still expose unintended model attributes, trigger exceptions for invalid fields, and weaken authorization assumptions if higher layers rely on this DAO to restrict queryable columns.
