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
- 88% confidence
- Finding
- Here getattr(self.__model__, key) is driven by caller-supplied filter keys, allowing unvalidated selection of any mapped attribute on the model. While SQLAlchemy prevents classic SQL injection in the value, this can expose unintended fields for querying, enable unauthorized enumeration over sensitive columns, and cause crashes or information leakage if invalid/internal attributes are referenced by upstream callers.
