Security
- Validate user-supplied URL path segments (
ori,district_code, use-of-forcegroup/spec) via newvalidate_path_segment(), rejecting/,\, and..to prevent path traversal / endpoint redirection - Stop surfacing or logging the raw
httpxexception inapi_get()'s network-error branch; some httpx errors carry the request URL, which includes theAPI_KEYquery parameter. The response is now a generic message and only the exception type is logged
Fixed
manage_cacheruns its blocking filesystem I/O (glob/read/rmtree) viaasyncio.to_threadso it no longer stalls the event loop, while keeping FastMCP middleware stats reads/resets on the event loop to avoid cross-thread access
Changed
validate_path_segmenterror messages now spell out the non-empty and no-..constraints rather than implying them via the allowed-character list- Dependabot now tracks the Python (
pip) andgithub-actionsecosystems instead of the unusednpmecosystem
Added
- Regression tests for
validate_path_segment, theoripath throughvalidate_crime_data_params, malicious-ORI rejection inget_police_employment, path-segment rejection inlookup_agencyandget_use_of_force_data, and_collect_statsskipping non-caching middleware
Full Changelog: v0.3.1...v0.4.0