fix(security): allowed-roots gap-fill; thumbnail and download confined - #534
fix(security): allowed-roots gap-fill; thumbnail and download confined#534chodeus wants to merge 1 commit into
Conversation
poster_renamerr.music_source_dirs and asset_renamerr's source/music/ destination dirs feed poster_cache but were invisible to path_safety, so the picker, preview and both poster file endpoints refused their own legitimate art. get_poster_thumbnail and download_poster now route through resolve_confined (bare realpath authorized nothing); escaping paths get the file's standard 403, malformed config surfaces as 500 instead of a masked generic error. poster_cleanarr.asset_dirs joins as the same class of CHUB-operated dirs.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
Comment |
py/path-injection 318/319/320: both routes fed a bare realpath into PIL and FileResponse — normalizing, never authorizing. Same resolve_confined guard #534 gives them, so the two branches converge on one shape rather than conflicting. A poisoned row now gets 403 at both routes, pinned by a test that reddens when either guard is reverted.
What
get_allowed_roots()gains the config dirs that feedposter_cachebut were invisible to path_safety:poster_renamerr.music_source_dirsand asset_renamerr's source/music/destination dirs (traced producer-by-producer — the brief's assumedposter_cleanarr.asset_dirsturned out NOT to be a producer, but joins as the same class of CHUB-operated dirs the picker/preview/backup checks also refused). Fail-closed semantics preserved; unset keys add nothing (a discriminating test proves the empty-string→CWD trap stays impossible).get_poster_thumbnailanddownload_posterroute throughresolve_confined()— their barerealpathauthorized nothing despite the comment claiming traversal protection. Escaping paths get the file's standard 403; malformed config now surfaces as 500CONFIG_INVALIDinstead of being masked as a generic error. Success behavior byte-identical.Verification
Route-level tests prove both directions (serves under each new root, 403s an escape — each reddened by reverting the guard); full suite green ×2; ruff clean.
Flagged for later (ledgered)
posters.py optimize path stores a basename over the absolute
fileand mints a duplicate row via the UNIQUE key (pre-existing data bug — those rows 404'd before, 403 now, broken either way);get_allowed_rootsresolves+stats every root per call on a per-tile route — worth caching the resolved set.