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
- 77% confidence
- Finding
- This code uses unvalidated filter keys from the caller to dynamically access model attributes. While SQLAlchemy prevents classic SQL injection here, an attacker or untrusted caller can trigger unauthorized querying over sensitive columns, bypass intended field restrictions, or cause crashes via invalid attributes, which becomes more concerning because this module also stores tokens and identity data unrelated to the child-safety purpose.
