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
- 80% confidence
- Finding
- This query builder accepts filter keys and passes them into getattr(self.__model__, key) without validating that the requested field is in an approved set. While SQLAlchemy prevents classic SQL injection here, untrusted callers can still query on unintended model attributes or sensitive columns, enabling overbroad data access and weakening authorization boundaries if higher layers pass user-controlled filters.
