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
- 69% confidence
- Finding
- Here, filter keys come from the caller-provided filters dict and are passed into getattr(self.__model__, key) without validation. While this is not SQL injection because SQLAlchemy still parameterizes values, it can expose unintended model attributes, trigger errors/DoS via invalid keys, and enable unauthorized querying on sensitive columns if higher layers pass user-controlled filters through.
