Skip to content

feat(auth): isolate chat sessions per user with ownership checks - #113

Merged
lzq986 merged 1 commit into
mainfrom
feat/session-isolation
Aug 12, 2026
Merged

feat(auth): isolate chat sessions per user with ownership checks#113
lzq986 merged 1 commit into
mainfrom
feat/session-isolation

Conversation

@lzq986

@lzq986 lzq986 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

relate #104

  • Add user_session ownership table; first visitor claims a session via INSERT IGNORE. History/debug/clear now verify ownership (non-owner → 404, existence not leaked). Session listing filters by user, and clearAllSessions is admin-only (403 otherwise); admin (role_id=1) bypasses via resolveUserId() returning null.

  • userId is threaded from the servlet thread through chatStream into ToolCallContext so Reactor threads never read ThreadLocal. ADMIN_ROLE_ID is centralized into Constants. Model config switches to deepseek-v4-flash

- Add user_session ownership table; first visitor claims a session via
INSERT IGNORE. History/debug/clear now verify ownership (non-owner →
404, existence not leaked). Session listing filters by user, and
clearAllSessions is admin-only (403 otherwise); admin (role_id=1)
bypasses via resolveUserId() returning null.

userId is threaded from the servlet thread through chatStream into
ToolCallContext so Reactor threads never read ThreadLocal. ADMIN_ROLE_ID
is centralized into Constants. Model config switches to deepseek-v4-flash
@github-actions

Copy link
Copy Markdown

Thank you for your contribution! We will review your request as soon as possible. Please review the code yourself using ponytail https://github.com/DietrichGebert/ponytail.

@lzq986
lzq986 merged commit d733a87 into main Aug 12, 2026
4 checks passed
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.

1 participant