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
- 76% confidence
- Finding
- This query builder accepts filter keys dynamically and resolves them via getattr(self.__model__, key). While SQLAlchemy prevents classic SQL injection here, untrusted callers can still select arbitrary model columns for filtering, which can enable unauthorized querying over sensitive fields and weaken intended access controls if this generic DAO is exposed to higher layers.
