Skip to content

fix(security): allowed-roots gap-fill; thumbnail and download confined - #534

Open
chodeus wants to merge 1 commit into
mainfrom
fix/allowed-roots-gap-fill
Open

fix(security): allowed-roots gap-fill; thumbnail and download confined#534
chodeus wants to merge 1 commit into
mainfrom
fix/allowed-roots-gap-fill

Conversation

@chodeus

@chodeus chodeus commented Aug 14, 2026

Copy link
Copy Markdown
Owner

What

  • get_allowed_roots() gains the config dirs that feed poster_cache but were invisible to path_safety: poster_renamerr.music_source_dirs and asset_renamerr's source/music/destination dirs (traced producer-by-producer — the brief's assumed poster_cleanarr.asset_dirs turned 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_thumbnail and download_poster route through resolve_confined() — their bare realpath authorized nothing despite the comment claiming traversal protection. Escaping paths get the file's standard 403; malformed config now surfaces as 500 CONFIG_INVALID instead 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 file and mints a duplicate row via the UNIQUE key (pre-existing data bug — those rows 404'd before, 403 now, broken either way); get_allowed_roots resolves+stats every root per call on a per-tile route — worth caching the resolved set.

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.
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 46 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 80e8e6f1-8b26-453b-a717-f481b4e32166

📥 Commits

Reviewing files that changed from the base of the PR and between c863872 and 6eeec2f.

📒 Files selected for processing (4)
  • backend/api/posters.py
  • backend/util/path_safety.py
  • tests/test_api_smoke.py
  • tests/test_path_safety.py

Comment @coderabbitai help to get the list of available commands.

chodeus added a commit that referenced this pull request Aug 14, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant