Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
df59ceb
Initial plan
Copilot Jan 4, 2026
ed24e94
Initial plan
Copilot Jan 4, 2026
5d25c5e
Add GitHub Copilot instructions file
Copilot Jan 4, 2026
b94cdc4
Address code review feedback: clarify versions and tooling
Copilot Jan 4, 2026
de57ce1
Add comprehensive multi-user support specification and implementation…
Copilot Jan 4, 2026
1c5159c
Clarify Python tooling transition state
Copilot Jan 4, 2026
c227eb6
Add executive summary for multi-user support specification
Copilot Jan 4, 2026
488ced1
Merge pull request #4 from lstein/copilot/set-up-copilot-instructions
lstein Jan 4, 2026
34a1c27
Reorganize multiuser docs into subfolder and update with approved des…
Copilot Jan 4, 2026
ff3dadc
docs: fix mkdocs syntax issues
lstein Jan 4, 2026
8bd70c0
Merge pull request #2 from lstein/copilot/add-multiuser-support
lstein Jan 4, 2026
9ca69d8
Merge pull request #9 from invoke-ai/main
lstein Jan 5, 2026
4201d4c
Fix Z-Image VAE operations not reserving working memory for OOM preve…
Copilot Jan 5, 2026
df68fb2
Merge remote-tracking branch 'upstream/main' into lstein-master
lstein Jan 7, 2026
45d76d5
Phase 1: Add multi-user database schema and authentication foundation…
Copilot Jan 7, 2026
48232a2
Implement Phase 2: Authentication Service with JWT and FastAPI Integr…
Copilot Jan 8, 2026
8d0cd1e
Add Phase 3 integration tests and documentation for authentication mi…
Copilot Jan 8, 2026
9e11f54
chore: fix merge conflicts
lstein Jan 8, 2026
4d45fc1
chore: fix unresolved merged conflict markers
lstein Jan 8, 2026
0f970a0
Phase 4: Add multi-tenancy to boards and session queue services (#17)
Copilot Jan 10, 2026
e654342
Merge branch 'invoke-ai:main' into lstein-master
lstein Jan 10, 2026
fa1deae
feat: Implement Phase 5 of multiuser plan - Frontend authentication (…
Copilot Jan 12, 2026
7418e3e
feat: Implement Phase 6 frontend UI updates - UserMenu and admin rest…
Copilot Jan 12, 2026
e115060
feat: Add user management script for testing multiuser features
Copilot Jan 12, 2026
54adf97
feat: Implement read-only model manager access for non-admin users
Copilot Jan 12, 2026
e515096
Merge branch 'invoke-ai:main' into lstein-master
lstein Jan 12, 2026
80c2bb7
Phase 7: Comprehensive testing and security validation for multiuser …
Copilot Jan 13, 2026
495cdac
Merge branch 'invoke-ai:main' into lstein-master
lstein Jan 13, 2026
c9f01ad
Merge branch 'invoke-ai:main' into lstein-master
lstein Jan 17, 2026
d83fb9f
Backend: Add admin board filtering and uncategorized board isolation
Copilot Jan 13, 2026
cdd593f
Fix intermittent token service test failures caused by Base64 padding…
Copilot Jan 18, 2026
6ae8a74
Implement user isolation for session queue and socket events (WIP - d…
Copilot Jan 18, 2026
05c293e
Fix Queue tab not updating for other users in real-time (#34)
Copilot Jan 19, 2026
174a6c3
Fix multiuser information leakage in Queue panel detail view (#38)
Copilot Jan 20, 2026
a8b6cf7
fix(queue): Enforce user permissions for queue operations in multiuse…
Copilot Jan 20, 2026
e493a9a
Merge branch 'invoke-ai:main' into lstein-master
lstein Jan 21, 2026
4200421
fix(multiuser): Isolate client state per user to prevent data leakage…
Copilot Jan 21, 2026
ab5fa5d
feat(queue): show user/total pending jobs in multiuser mode badge (#43)
Copilot Jan 21, 2026
7955631
Convert session queue isolation logs from info to debug level
Copilot Jan 21, 2026
1068277
Add JWT secret storage in database and app_settings service
Copilot Jan 21, 2026
c9233c2
Add multiuser configuration option with default false
Copilot Jan 21, 2026
5660f43
Update token service tests to initialize JWT secret
Copilot Jan 21, 2026
ee65751
Fix app_settings_service to use proper database transaction pattern
Copilot Jan 21, 2026
79a6d80
chore(backend): typegen and ruff
lstein Jan 21, 2026
fedf076
chore(docs): update docstrings
lstein Jan 21, 2026
d9e51a1
Fix frontend to bypass authentication in single-user mode
Copilot Jan 21, 2026
7ff2093
Fix auth tests to enable multiuser mode
Copilot Jan 21, 2026
e5a8724
Fix model manager UI visibility in single-user mode
Copilot Jan 21, 2026
013c495
chore(backend): ruff
lstein Jan 21, 2026
0234ac8
chore(frontend): typegen
lstein Jan 21, 2026
930d23d
Fix TypeScript lint errors
Copilot Jan 21, 2026
d0798a4
Fix test_data_isolation to enable multiuser mode
Copilot Jan 21, 2026
65a1093
Redirect login and setup pages to app in single-user mode
Copilot Jan 21, 2026
e4b043b
Fix test_auth.py to initialize JWT secret
Copilot Jan 21, 2026
08b5e8d
Prevent login form flash in single-user mode
Copilot Jan 21, 2026
e3d17b7
Fix board and queue operations in single-user mode
Copilot Jan 21, 2026
32771df
Add user management utilities and rename add_user.py
Copilot Jan 21, 2026
9ba6a1b
Fix ESLint errors in frontend code
Copilot Jan 22, 2026
9dc956e
Add userlist.py script for viewing database users
Copilot Jan 22, 2026
23e3486
Fix test_boards_multiuser.py test failures
Copilot Jan 22, 2026
1098fae
chore(backend): ruff
lstein Jan 22, 2026
e8a54a2
Fix userlist.py SqliteDatabase initialization
Copilot Jan 22, 2026
8f6f64a
Fix test_boards_multiuser.py by adding app_settings service to mock
Copilot Jan 22, 2026
2490eb6
bugfix(scripts): fix crash in userlist.py script
lstein Jan 22, 2026
4a5e91d
Fix test_boards_multiuser.py JWT secret initialization
Copilot Jan 22, 2026
5a9da1b
Fix CurrentUserOrDefault to require auth in multiuser mode
Copilot Jan 22, 2026
2786b7d
chore(front & backend): ruff and lint
lstein Jan 22, 2026
a413580
Add AdminUserOrDefault and fix model settings in single-user mode
Copilot Jan 22, 2026
d3d0c9a
Fix model manager operations in single-user mode
Copilot Jan 22, 2026
eae1eba
Fix syntax error in model_manager.py
Copilot Jan 22, 2026
2acb320
Fix FastAPI dependency injection syntax error
Copilot Jan 22, 2026
2ae67e1
Fix delete_model endpoint parameter annotation
Copilot Jan 22, 2026
ea7a12a
Fix parameter annotations for all AdminUserOrDefault endpoints
Copilot Jan 22, 2026
df5482a
Revert to correct AdminUserOrDefault usage pattern
Copilot Jan 22, 2026
1a3218b
Fix parameter order for AdminUserOrDefault in model manager
Copilot Jan 22, 2026
0393a59
chore(frontend): typegen
lstein Jan 22, 2026
4a0e4f4
chore(frontend): typegen again
lstein Jan 22, 2026
3ebc6bb
Docs(app): Comprehensive Documentation of Multiuser Features (#50)
lstein Jan 23, 2026
a359b62
docs(app): update multiuser documentation
lstein Jan 23, 2026
98bab15
chore: resolve conflicts with remote merge
lstein Jan 28, 2026
1ff8b07
bugfix(app): fix misaligned database migration calls
lstein Jan 28, 2026
5363e4a
Merge branch 'main' into lstein-master
lstein Jan 28, 2026
62edbf2
chore(tests): update migration test to accommodate resequencing of mi…
lstein Jan 28, 2026
0c00a14
Merge branch 'invoke-ai:main' into feature/multiuser
lstein Feb 1, 2026
46e4f45
Merge branch 'main' into feature/multiuser
JPPhoto Feb 1, 2026
3d483f6
Merge branch 'main' into feature/multiuser
JPPhoto Feb 4, 2026
013a5b6
Merge branch 'main' into feature/multiuser
lstein Feb 16, 2026
eeffcd5
Merge branch 'invoke-ai:main' into feature/multiuser
lstein Feb 18, 2026
6aba4d6
fix(frontend): prevent caching of static pages
lstein Feb 19, 2026
87d467c
chore(backend): ruff
lstein Feb 19, 2026
e4d5e31
fix: resolve merge conflicts
lstein Feb 20, 2026
c3473c8
fix(backend): fix incorrect migration import
lstein Feb 20, 2026
9e11528
Fix: Admin users can see image previews from other users' generations…
Copilot Feb 20, 2026
e23a1e4
fix(queue): System user queue items show blank instead of `<hidden>` …
Copilot Feb 20, 2026
7fff36d
Hide "Use Cache" checkbox in node editor for non-admin users in multi…
Copilot Feb 20, 2026
47586fe
Fix node loading hang when invoke URL ends with /app (#67)
Copilot Feb 20, 2026
92a072f
Merge branch 'main' into feature/multiuser
lstein Feb 20, 2026
a2b46dc
Move user management scripts to installable module with CLI entry poi…
Copilot Feb 20, 2026
8a5a717
chore(backend): reorganized migrations, but something still broken
lstein Feb 20, 2026
1454078
merge with main
lstein Feb 20, 2026
a8fb5c9
Fix migration 28 crash when `client_state.data` column is absent (#70)
Copilot Feb 20, 2026
24a7153
Consolidate multiuser DB migrations 27–29 into a single migration ste…
Copilot Feb 20, 2026
b4ab173
Merge branch 'main' into feature/multiuser
lstein Feb 21, 2026
eac412d
Add `--root` option to user management CLI utilities (#81)
Copilot Feb 23, 2026
a990e77
Fix queue clear() endpoint to respect user_id for multi-tenancy (#75)
Copilot Feb 23, 2026
e5413d8
fix: use AdminUserOrDefault for pause and resume queue endpoints (#77)
Copilot Feb 23, 2026
a888c2e
fix: queue pause/resume buttons disabled in single-user mode (#83)
Copilot Feb 23, 2026
a36e110
fix: enforce board ownership checks in multiuser mode (#84)
Copilot Feb 23, 2026
a0b6359
Fix: Clear auth state when switching from multiuser to single-user mo…
Copilot Feb 23, 2026
5c9863c
Merge branch 'main' into feature/multiuser
JPPhoto Feb 23, 2026
919ccaf
Merge branch 'main' into feature/multiuser
JPPhoto Feb 24, 2026
e0b391b
Merge branch 'main' into feature/multiuser
JPPhoto Feb 25, 2026
7665bc1
Merge branch 'main' into feature/multiuser
lstein Feb 26, 2026
357b3cf
Merge branch 'main' into feature/multiuser
lstein Feb 27, 2026
b67efc8
Fix race conditions in download queue and model install service (#98)
Copilot Feb 27, 2026
b7c9448
Merge branch 'main' into feature/multiuser
lstein Feb 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ help:
@echo "frontend-build Build the frontend in order to run on localhost:9090"
@echo "frontend-dev Run the frontend in developer mode on localhost:5173"
@echo "frontend-typegen Generate types for the frontend from the OpenAPI schema"
@echo "wheel Build the wheel for the current version"
@echo "frontend-prettier Format the frontend using lint:prettier"
@echo "wheel Build the wheel for the current version"
@echo "tag-release Tag the GitHub repository with the current version (use at release time only!)"
@echo "openapi Generate the OpenAPI schema for the app, outputting to stdout"
@echo "docs Serve the mkdocs site with live reload"

# Runs ruff, fixing any safely-fixable errors and formatting
ruff:
ruff check . --fix
ruff format .
cd invokeai && uv tool run ruff@0.11.2 format

# Runs ruff, fixing all errors it can fix and formatting
ruff-unsafe:
ruff check . --fix --unsafe-fixes
ruff format .
ruff format

# Runs mypy, using the config in pyproject.toml
mypy:
Expand Down Expand Up @@ -64,6 +64,13 @@ frontend-dev:
frontend-typegen:
cd invokeai/frontend/web && python ../../../scripts/generate_openapi_schema.py | pnpm typegen

frontend-lint:
cd invokeai/frontend/web/src && \
pnpm lint:tsc && \
pnpm lint:dpdm && \
pnpm lint:eslint --fix && \
pnpm lint:prettier --write

# Tag the release
wheel:
cd scripts && ./build_wheel.sh
Expand All @@ -79,4 +86,4 @@ openapi:
# Serve the mkdocs site w/ live reload
.PHONY: docs
docs:
mkdocs serve
mkdocs serve
169 changes: 169 additions & 0 deletions USER_ISOLATION_IMPLEMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
# User Isolation Implementation Summary

This document describes the implementation of user isolation features in the InvokeAI session queue and processing system to address issues identified in the enhancement request.

## Issues Addressed

### 1. Cross-User Image/Preview Visibility
**Problem:** When two users are logged in simultaneously and one initiates a generation, the generation preview shows up in both users' browsers and the generated image gets saved to both users' image boards.

**Solution:** Implemented socket-level event filtering based on user authentication:

#### Backend Changes (`invokeai/app/api/sockets.py`):
- Added socket authentication middleware in `_handle_connect()` method
- Extracts JWT token from socket auth data or HTTP headers
- Verifies token using existing `verify_token()` function
- Stores `user_id` and `is_admin` in socket session for later use
- Modified `_handle_queue_event()` to filter events by user:
- For `QueueItemEventBase` events, only emit to:
- The user who owns the queue item (`user_id` matches)
- Admin users (`is_admin` is True)
- For general queue events, emit to all subscribers

#### Event System Changes (`invokeai/app/services/events/events_common.py`):
- Added `user_id` field to `QueueItemEventBase` class
- Updated all event builders to include `user_id` from queue items:
- `InvocationStartedEvent.build()`
- `InvocationProgressEvent.build()`
- `InvocationCompleteEvent.build()`
- `InvocationErrorEvent.build()`
- `QueueItemStatusChangedEvent.build()`

### 2. Batch Field Values Privacy
**Problem:** Users can see batch field values from generation processes launched by other users.

**Solution:** Implemented field value sanitization at the API level:

#### API Router Changes (`invokeai/app/api/routers/session_queue.py`):
- Created `sanitize_queue_item_for_user()` helper function
- Clears `field_values` for non-admin users viewing other users' items
- Admins and item owners can see all field values
- Updated endpoints to require authentication and sanitize responses:
- `list_all_queue_items()` - Added `CurrentUser` dependency
- `get_queue_items_by_item_ids()` - Added `CurrentUser` dependency
- `get_queue_item()` - Added `CurrentUser` dependency

### 3. Queue Updates Across Browser Windows
**Problem:** When the job queue tab is open in multiple browsers and a generation is begun in one browser window, the queue does not update in the other window.

**Status:** This issue is likely resolved by the socket authentication and event filtering changes. The existing socket subscription mechanism (`subscribe_queue` event) already supports multiple connections per user. Testing is required to confirm this works correctly with the new authentication flow.

### 4. User Information Display
**Problem:** Queue table lacks user identification, making it difficult to know who launched which job.

**Solution:** Added user information to queue items and UI:

#### Database Layer (`invokeai/app/services/session_queue/session_queue_sqlite.py`):
- Updated SQL queries to JOIN with `users` table
- Modified methods to fetch user information:
- `get_queue_item()` - Now selects `display_name` and `email` from users table
- `dequeue()` - Includes user info
- `get_next()` - Includes user info
- `get_current()` - Includes user info
- `list_all_queue_items()` - Includes user info

#### Data Model Changes (`invokeai/app/services/session_queue/session_queue_common.py`):
- Added optional fields to `SessionQueueItem`:
- `user_display_name: Optional[str]` - Display name from users table
- `user_email: Optional[str]` - Email from users table
- Note: `user_id` field already existed from Migration 25

#### Frontend UI Changes:
- **Constants** (`constants.ts`): Added `user: '8rem'` column width
- **Header** (`QueueListHeader.tsx`): Added "User" column header
- **Item Component** (`QueueItemComponent.tsx`):
- Added logic to display user information (display_name → email → user_id)
- Added user column to queue item row
- Added tooltip with full username on hover
- Added "Hidden for privacy" message when field_values are null for non-owned items
- **Localization** (`en.json`): Added translations:
- `"user": "User"`
- `"fieldValuesHidden": "Hidden for privacy"`

## Security Considerations

### Token Verification
- Tokens are verified using the existing `verify_token()` function from `invokeai.app.services.auth.token_service`
- Invalid or missing tokens default to "system" user with non-admin privileges
- Socket connections without valid tokens are still accepted for backward compatibility but have limited access

### Data Privacy
- Field values are only visible to:
- The user who created the queue item
- Admin users
- Non-admin users viewing other users' queue items see "Hidden for privacy" instead of field values

### Admin Privileges
- Admin users can see all queue events and field values across all users
- Admin status is determined from the JWT token's `is_admin` field

## Migration Notes

No database migration is required. The changes leverage:
- Existing `user_id` column in `session_queue` table (added in Migration 25)
- Existing `users` table (added in Migration 25)
- SQL LEFT JOINs to fetch user information (gracefully handles missing user records)

## Testing Requirements

### Backend Testing
1. **Socket Authentication:**
- Verify valid tokens are accepted and user context is stored
- Verify invalid tokens default to system user
- Verify expired tokens are rejected

2. **Event Filtering:**
- User A should only receive events for their own queue items
- Admin users should receive all events
- Non-admin users should not receive events from other users

3. **Field Value Sanitization:**
- Non-admin users should see null field_values for other users' items
- Admins should see all field values
- Users should see their own field values

### Frontend Testing
1. **UI Display:**
- User column should display in queue list
- Display name should be shown when available
- Email should be shown as fallback when display name is missing
- User ID should be shown when both display name and email are missing
- Tooltip should show full username on hover

2. **Field Values Display:**
- "Hidden for privacy" message should appear when viewing other users' items
- Own items should show field values normally

3. **Multi-Browser Testing:**
- Open queue tab in two browsers with different users
- Start generation in one browser
- Verify other browser doesn't see the preview/progress
- Verify admin user can see all generations

### Integration Testing
1. Multi-user scenarios with simultaneous generations
2. Queue updates across multiple browser windows
3. Admin vs. non-admin privilege differentiation
4. Socket reconnection handling

## Known Limitations

1. **TypeScript Types:**
- The OpenAPI schema needs to be regenerated to include new fields
- Run: `cd invokeai/frontend/web && python ../../../scripts/generate_openapi_schema.py | pnpm typegen`

2. **Backward Compatibility:**
- System user ("system") entries will not have display name or email
- Existing queue items from before Migration 25 will have user_id="system"

3. **Socket.IO Session Storage:**
- Socket.IO's in-memory session storage may not persist across server restarts
- Consider implementing persistent session storage if needed for production

## Future Enhancements

1. Add user filtering to queue list (show only my items vs. all items)
2. Add permission system for queue management operations (cancel, retry, delete)
3. Implement queue item ownership transfer for administrative purposes
4. Add audit logging for queue operations with user attribution
5. Consider implementing user-specific queue limits or quotas
4 changes: 3 additions & 1 deletion docs/installation/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ Invoke runs on Windows 10+, macOS 14+ and Linux (Ubuntu 20.04+ is well-tested).

Hardware requirements vary significantly depending on model and image output size.

The requirements below are rough guidelines for best performance. GPUs with less VRAM typically still work, if a bit slower. Follow the [Low-VRAM mode guide](./features/low-vram.md) to optimize performance.
The requirements below are rough guidelines for best performance. GPUs
with less VRAM typically still work, if a bit slower. Follow the
[Low-VRAM mode guide](../features/low-vram.md) to optimize performance.

- All Apple Silicon (M1, M2, etc) Macs work, but 16GB+ memory is recommended.
- AMD GPUs are supported on Linux only. The VRAM requirements are the same as Nvidia GPUs.
Expand Down
Loading