Validate sort_by parameter against allowed field names in views.py
#36
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-database#36
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
app/routers_v3/views.py:27— Thesort_byparameter is passed togetattr(SeasonBattingStats, stat, ...). Any arbitrary string can be passed. Should be aLiteraltype of allowed stat column names.Priority: medium | Labels: security, enhancement
Fixed in PR #44: #44
Changed
sort_by: strtosort_by: Literal[...]in bothget_season_batting_statsandget_season_pitching_stats. FastAPI will now reject arbitrary strings with a 422 before they reach thegetattrcall. Allowed values were derived directly from the column fields defined onSeasonBattingStatsandSeasonPitchingStatsindb_engine.py.