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
- Here getattr(self.__model__, key) uses keys taken from the caller-provided filters dictionary, so untrusted input can select arbitrary model attributes. While SQLAlchemy still parameterizes values, this can enable unauthorized querying on sensitive columns, trigger exceptions for invalid attributes, and weaken intended access control boundaries if higher layers pass user-controlled filters directly.
