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
- 80% confidence
- Finding
- This code uses getattr(self.__model__, key) on keys taken directly from the caller-provided filters dict, without validating that the key is an allowed column name. An attacker who can influence filters may trigger access to unintended model attributes, causing exceptions, unstable query behavior, or bypass of intended field restrictions; in some ORM contexts, this pattern can expose internal attributes or enable querying on fields that should not be user-selectable.
