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
- 75% confidence
- Finding
- This method applies filter keys directly via getattr(self.__model__, key) without validating them against an allowlist. While SQLAlchemy still parameterizes values and prevents classic SQL injection, untrusted callers can trigger unauthorized querying on sensitive columns or cause exceptions/behavior differences by selecting unexpected model attributes, which is risky in a generic DAO handling user records and tokens.
