Fix remaining critical review issue: list_worlds visibility filter bypass

Requesting an explicit ?visibility=PRIVATE (or FRIENDS_ONLY) skipped the
ownership check entirely — any authenticated user could list every other
user's private worlds just by passing the filter. Only the no-filter
default path enforced ownership. Now the ownership check applies whenever
a non-PUBLIC visibility is requested, explicit or not.

Also fixed current_user: CurrentUser = Depends() in assets.py (redundant
empty Depends() on an already-Annotated dependency, inconsistent with
every other endpoint) to plain current_user: CurrentUser per the review
feedback, and reordered params since that made it a non-default arg
following a defaulted one (SyntaxError otherwise).

Verified: py_compile clean, full app imports and loads in a clean venv.
This commit is contained in:
coder-bot
2026-08-18 00:14:37 +00:00
parent 241fa9d0e0
commit 5d7c61029c
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -171,8 +171,8 @@ async def delete_asset(
@router.post("/{asset_id}/upload", response_model=AssetResponse)
async def upload_asset_file(
asset_id: int,
current_user: CurrentUser,
file: UploadFile = File(...),
current_user: CurrentUser = Depends(),
db: AsyncSession = Depends(get_db),
):
"""Upload a file for an existing asset."""