Skip to content

fix: enforce ownership on conversation write endpoints - #2305

Open
yaodong-shen wants to merge 1 commit into
SciPhi-AI:mainfrom
yaodong-shen:fix/conversation-ownership
Open

fix: enforce ownership on conversation write endpoints#2305
yaodong-shen wants to merge 1 commit into
SciPhi-AI:mainfrom
yaodong-shen:fix/conversation-ownership

Conversation

@yaodong-shen

Copy link
Copy Markdown

Summary

  • propagate the authenticated user constraint from conversation write routes through the management service
  • enforce conversation ownership before rename and message creation at the database boundary
  • bind message edits to both the supplied conversation ID and its owner, closing the adjacent write path that previously ignored the conversation ID
  • preserve existing superuser and trusted internal-call behavior, while returning the same 404-style response used by protected reads for unauthorized access

Closes #2292

Validation

  • py/.venv/bin/pytest py/tests/unit/database/test_conversation_ownership.py py/tests/unit/app/test_routes.py -q --no-cov — 36 passed
  • py/.venv/bin/ruff check py/core/main/api/v3/conversations_router.py py/core/main/services/management_service.py py/core/providers/database/conversations.py py/tests/unit/database/test_conversation_ownership.py — passed
  • cd py && .venv/bin/python -m mypy --follow-imports=skip core/main/api/v3/conversations_router.py core/main/services/management_service.py core/providers/database/conversations.py — passed
  • compileall and git diff --check — passed

Repository-wide baseline

pre-commit run --all-files was also exercised. The untouched origin/main baseline is not clean: mypy reports an existing UnstructuredClient | AsyncClient post union-attribute error in core/providers/ingestion/unstructured/base.py, reproduced from a clean detached origin/main worktree. The all-files formatter also changes existing unrelated files, so those changes were intentionally excluded from this focused security fix.

@yaodong-shen

Copy link
Copy Markdown
Author

The Code Quality Checks and R2R Light Python Integration Test workflows are waiting for maintainer approval and created no jobs for this external-fork PR. The focused ownership regression suite, Ruff, and targeted mypy checks pass locally. Could a maintainer approve the workflow runs when convenient?

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.

[Security] Cross-user conversation IDOR

2 participants