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
- 86% confidence
- Finding
- This method accepts arbitrary filter keys and resolves them with getattr(self.__model__, key) without validating that the field is intended to be queryable. While SQLAlchemy prevents classic SQL injection here, untrusted callers can still query on unexpected columns such as token, open_token, del_flag, or internal metadata, which can enable unauthorized enumeration or bypass of business restrictions if this generic DAO is exposed through higher layers. In a multi-skill/shared-database context, generic unrestricted filtering is more dangerous because it increases the chance that one component can probe sensitive records created by another.
