-
Notifications
You must be signed in to change notification settings - Fork 0
fix(multiuser): Isolate client state per user to prevent data leakage #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: lstein-master
Are you sure you want to change the base?
Conversation
Co-authored-by: lstein <[email protected]>
Co-authored-by: lstein <[email protected]>
…imestamp update Co-authored-by: lstein <[email protected]>
|
@copilot This is not working as expected. Now when I reload the page the previous parameters disappear and are reset to their defaults. |
…rt single-user mode Co-authored-by: lstein <[email protected]>
Fixed in commit 356302f. The issue was that I made authentication mandatory, which broke single-user mode and installations without authentication enabled. The endpoints now use optional authentication:
Your previous parameters should now persist correctly on reload in both single-user and multiuser modes. |
Co-authored-by: lstein <[email protected]>
|
@copilot I'm afraid you've got a pydantic validation error now: |
…m user Co-authored-by: lstein <[email protected]>
Fixed in commit 7d728de. The |
|
@copilot I've just tested the latest commit and the multiuser isolation is not working as expected. When user A runs a generation and user B reloads the page, B sees A's generation parameters.a |
Co-authored-by: lstein <[email protected]>
Fixed in commit 80046fc. The root cause was that the frontend's The fix adds a
Multiuser isolation should now work correctly. |
Co-authored-by: lstein <[email protected]>
Summary
In multiuser mode, client state (generation parameters, UI state) was shared between all users due to two critical issues:
client_statetable was designed with a single-row constraint (CHECK(id = 1)), forcing all users to share the same state rowdriver.tsfile was making fetch calls to client_state endpoints without including theAuthorizationheader, causing all authenticated users to fall back to the 'system' userChanges:
client_statetable from single shared row to per-user storage with(user_id, key)primary keyClientStatePersistenceABCandClientStatePersistenceSqliteto useuser_idfor isolationCurrentUserOrDefaultdependency - authenticated requests use the user's ID, unauthenticated requests use 'system' user for backwards compatibilityget_current_user_or_default()function with logging for debugging fallback scenarios. Fixed to include all required TokenData fields (user_id, email, is_admin)getAuthHeaders()helper to include auth token from localStorage and Content-Type header in all fetch requests to client_state endpointsHow It Works:
Existing state migrates to 'system' user. Frontend remains compatible -
queue_idparameter kept but ignored in favor ofuser_id.Related Issues / Discussions
Resolves multiuser generation parameter leakage issue where User B would see User A's parameters on browser reload.
QA Instructions
Multiuser Mode (with authentication enabled):
Single-User Mode (without authentication):
API behavior verification:
Merge Plan
Database migration from version 25→26 runs automatically on startup. No special merge considerations - migration is idempotent and handles both new installs and upgrades.
Checklist
What's Newcopy (if doing a release after this PR)Original prompt
💡 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.