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 method applies filters using getattr(self.__model__, key) where key comes from the caller-provided filters dictionary. Without validating allowed field names, an attacker or unintended caller can query on arbitrary model attributes, which can expose fields the API did not intend to make queryable and can trigger exceptions for invalid attributes, enabling denial-of-service against callers that do not handle them safely.
