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
- 74% confidence
- Finding
- This code accepts filter keys and resolves them directly as model attributes via getattr(self.__model__, key) without validating that the caller is allowed to query on those fields. While SQLAlchemy still parameterizes values and prevents classic SQL injection, an attacker controlling filter keys can enumerate or query sensitive columns and trigger errors or unintended data exposure through overly broad generic querying. In this skill, a general-purpose user DAO is unrelated to infant-cry classification, which increases concern because it expands local data access beyond the declared function.
