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
- 72% confidence
- Finding
- The list() method applies filters using getattr(self.__model__, key) where key comes from the caller. Although this does not look like SQL injection because SQLAlchemy parameterizes values, it can still expose unintended model attributes, trigger exceptions for invalid keys, and allow callers to query on sensitive columns that the API may not have intended to expose. In this skill context, the DAO is generic and likely reused across components, which increases the chance that untrusted filter dictionaries reach it.
