Skip to content

Comments

fix(boards): enforce ownership on update/delete endpoints in multiuser mode#79

Closed
Copilot wants to merge 255 commits intocopilot/set-up-copilot-instructionsfrom
copilot/fix-image-board-endpoints
Closed

fix(boards): enforce ownership on update/delete endpoints in multiuser mode#79
Copilot wants to merge 255 commits intocopilot/set-up-copilot-instructionsfrom
copilot/fix-image-board-endpoints

Conversation

Copy link

Copilot AI commented Feb 22, 2026

Summary

update_board and delete_board in boards.py accepted the CurrentUserOrDefault dependency but never used it — any authenticated user could modify or delete any board regardless of ownership.

Fix:

  • Both endpoints now fetch the board first (404 if missing), then reject with 403 if the caller is neither the board owner nor an admin:
if not current_user.is_admin and board.user_id != current_user.user_id:
    raise HTTPException(status_code=403, detail="Not authorized to update this board")

Tests (test_boards_multiuser.py):

  • Added regular_user1_token / regular_user2_token fixtures (real non-admin users, separate from the existing admin fixture)
  • 6 new ownership tests: non-owner blocked (update/delete), owner allowed (update/delete), admin bypasses check (update/delete)

Test infrastructure (conftest.py):

  • Replaced board_images=None with board_images=BoardImagesService() — the delete endpoint calls board_images.get_all_board_image_names_for_board, which was previously unavailable in the test mock

Related Issues / Discussions

QA Instructions

Run with multiuser mode enabled. Create a board as user A, then authenticate as user B and attempt PATCH /v1/boards/{id} and DELETE /v1/boards/{id} — both should return 403. The same requests as user A or as an admin should succeed.

Merge Plan

This PR is based on feature/multiuser and should be merged into that branch, not main.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)
Original prompt

This section details on the original issue you should resolve

<issue_title>[bug]: Image board endpoints do not respect current user in multiuser mode</issue_title>
<issue_description>### Is there an existing issue for this problem?

  • I have searched the existing issues

Install method

Invoke's Launcher

Operating system

Linux

GPU vendor

Nvidia (CUDA)

GPU model

No response

GPU VRAM

No response

Version number

feature/multiuser

Browser

No response

System Information

No response

What happened

In multiuser mode, several of the endpoints in invokeai/app/routers/boards.py fail to check that the current user has privileges to modify or delete the image board in question. These endpoints should use CurrentUserOrDefault and their underlying routines should ensure that the board is owned by the user (or that the request is being generated by the authenticated admin user).

What you expected to happen

These endpoints should respect the ownership of the boards when running in multiuser mode.

How to reproduce the problem

No response

Additional context

No response

Discord username

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 30 commits December 24, 2025 00:30
- Add explicit storage_device parameter (cpu)
- Add explicit log_memory_usage parameter from config
- Improves code clarity and configuration transparency

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
- Remove all trailing whitespace (W293 errors)
- Add debug logging when timeout fires but activity detected
- Add debug logging when timeout fires but cache is empty
- Only log "Clearing model cache" message when actually clearing
- Prevents misleading timeout messages during active generation

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Only log "Clearing model cache" message when there are actually unlocked
models to clear. This prevents the misleading message from appearing during
active generation when all models are locked.

Changes:
- Check for unlocked models before logging clear message
- Add count of unlocked models in log message
- Add debug log when all models are locked
- Improves user experience by avoiding confusing messages

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Configure mock logger to return a valid log level for getEffectiveLevel()
to prevent TypeError when comparing with logging.DEBUG constant.

The issue was that ModelCache._log_cache_state() checks
self._logger.getEffectiveLevel() > logging.DEBUG, and when the logger
is a MagicMock without configuration, getEffectiveLevel() returns another
MagicMock, causing a TypeError when compared with an int.

Fixes all 4 test failures in test_model_cache_timeout.py

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
…model-option' into copilot/add-unload-model-option
Add support for alternative diffusers Flow Matching schedulers:
- Euler (default, 1st order)
- Heun (2nd order, better quality, 2x slower)
- LCM (optimized for few steps)

Backend:
- Add schedulers.py with scheduler type definitions and class mapping
- Modify denoise.py to accept optional scheduler parameter
- Add scheduler InputField to flux_denoise invocation (v4.2.0)

Frontend:
- Add fluxScheduler to Redux state and paramsSlice
- Create ParamFluxScheduler component for Linear UI
- Add scheduler to buildFLUXGraph for generation
Add support for alternative diffusers Flow Matching schedulers for Z-Image:
- Euler (default) - 1st order, optimized for Z-Image-Turbo (8 steps)
- Heun (2nd order) - Better quality, 2x slower
- LCM - Optimized for few-step generation

Backend:
- Extend schedulers.py with Z-Image scheduler types and mapping
- Add scheduler InputField to z_image_denoise invocation (v1.3.0)
- Refactor denoising loop to support diffusers schedulers

Frontend:
- Add zImageScheduler to Redux state in paramsSlice
- Create ParamZImageScheduler component for Linear UI
- Add scheduler to buildZImageGraph for generation
Changed the default value of model_cache_keep_alive from 0 (indefinite)
to 5 minutes as requested. This means models will now be automatically
cleared from cache after 5 minutes of inactivity by default, unless
users explicitly configure a different value.

Users can still set it to 0 in their config to get the old behavior
of keeping models indefinitely.

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
LCM scheduler may have more internal timesteps than user-facing steps,
causing user_step to exceed total_steps. This resulted in progress
percentage > 1.0, which caused a pydantic validation error.

Fix: Only call step_callback when user_step <= total_steps.
DustyShoe and others added 18 commits February 20, 2026 02:41
…ai#8876)

Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
* Initial plan

* Fix canvas text tool breaking hotkeys when canvas manager is null

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>

* chore(frontend): fix eslint issue

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
…#61)

* Initial plan

* Fix: strip image preview from InvocationProgressEvent sent to admin room

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>

* chore: ruff

* fix(backend): add migration_29 file

* chore(tests): fix migration_29 test

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
…for non-admin users (#63)

* Initial plan

* fix(queue): System user queue items show blank instead of `<hidden>` for non-admin users

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>

* chore(backend): ruff

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
…user mode (#65)

* Initial plan

* Hide use cache checkbox for non-admin users in multiuser mode

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
* Initial plan

* Fix node loading hang when URL ends with /app

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
…nts (#69)

* Initial plan

* Add user management module with invoke-useradd/userdel/userlist/usermod entry points

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>

* chore(util): remove superceded user administration scripts

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
* Initial plan

* Fix migration 28 to handle missing data column in client_state table

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
#71)

* Initial plan

* Consolidate migrations 27, 28, and 29 into a single migration step

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Remove 5th parameter for function that expects 4 parameters

Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
…ke-ai#8889)

Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
Copilot AI and others added 2 commits February 22, 2026 19:03
… tests

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix image board endpoints to respect current user in multiuser mode fix(boards): enforce ownership on update/delete endpoints in multiuser mode Feb 22, 2026
Copilot AI requested a review from lstein February 22, 2026 19:21
@lstein lstein changed the base branch from copilot/set-up-copilot-instructions to feature/multiuser February 23, 2026 02:48
@lstein lstein changed the base branch from feature/multiuser to copilot/set-up-copilot-instructions February 23, 2026 02:48
@lstein
Copy link
Owner

lstein commented Feb 23, 2026

copilot royally screwed this one up.

@lstein lstein closed this Feb 23, 2026
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.