fix: enforce board ownership in multiuser mode for all board endpoints#84
Merged
lstein merged 1 commit intofeature/multiuserfrom Feb 23, 2026
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix image board endpoints to respect user privileges
fix: enforce board ownership in multiuser mode for all board endpoints
Feb 23, 2026
Author
Added 23 tests in
All 23 tests pass. |
- get_board: verify current user owns the board (or is admin), return 403 otherwise - update_board: verify ownership before updating, 404 if not found, 403 if unauthorized - delete_board: verify ownership before deleting, 404 if not found, 403 if unauthorized - list_all_board_image_names: add CurrentUserOrDefault auth and ownership check for non-'none' board IDs Co-authored-by: lstein <111189+lstein@users.noreply.github.com> test: add ownership enforcement tests for board endpoints in multiuser mode - Auth requirement tests for get, update, delete, and list_image_names - Cross-user 403 forbidden tests (non-owner cannot access/modify/delete) - Admin bypass tests (admin can access/update/delete any user's board) - Board listing isolation test (users only see their own boards) - Refactored fixtures to use monkeypatch (consistent with other test files) Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
245ed6b to
1bff5a1
Compare
lstein
approved these changes
Feb 23, 2026
Owner
lstein
left a comment
There was a problem hiding this comment.
Works as advertised, including new tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In multiuser mode,
get_board,update_board,delete_board, andlist_all_board_image_namesdid not verify that the requesting user owns the board, allowing any authenticated user to read, modify, or delete boards belonging to others.Summary
get_board: Added ownership check after fetch — returns 403 if requester is not admin and does not own the board.update_board: Pre-flight board fetch with ownership check before applying changes; returns 404 if not found, 403 if unauthorized.delete_board: Same pre-flight ownership check before deletion; returns 404 if not found, 403 if unauthorized.list_all_board_image_names: AddedCurrentUserOrDefault(previously unauthenticated) and ownership check for non-"none"board IDs.All checks follow the same pattern: admin users bypass ownership enforcement; regular users may only operate on boards where
board.user_id == current_user.user_id.Related Issues / Discussions
QA Instructions
Enable multiuser mode. Create two users. Log in as user A and create a board. Log in as user B and attempt to
GET,PATCH,DELETE, andGET /{board_id}/image_nameson user A's board — all should return403 Forbidden. Admin users should retain full access across all boards.The following automated tests in
tests/app/routers/test_boards_multiuser.pycover the new behaviour:GET /{board_id},PATCH /{board_id},DELETE /{board_id}, andGET /{board_id}/image_namesall return 401 when called without credentials in multiuser mode.noneboard auth: The specialnone(uncategorized) board still requires authentication but skips the ownership check.Merge Plan
Checklist
What's Newcopy (if doing a release after this PR)Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.