mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-05 15:59:56 +08:00
Security: lock down the TutorBot tool sandbox (shell exec is opt-in, all filesystem/shell access confined to the bot workspace) and isolate per-user resources, closing #518, #517, #516, #515, #514 and #506 (first hardened in #507). Bug fixes: chat input disabled after the first turn (#520), KB embedding failure on long documents (#521 / #509), profile creation under Docker (#512 / #513), Qwen reasoning models failing native tool calling (#527 / #528), the GPT-5 init-wizard token parameter (#508), and oversized session-event truncation (#524). Features: HTTP/SSE API for multi-turn chat with a specific TutorBot (#511), multimodal image fallback for vision-capable providers without a capability entry, safe ZIP knowledge upload, and a /settings/network page with model fetching (community PRs #522 and #523 reimplemented locally). Also bumps __version__ to 1.4.1, adds the v1.4.1 release notes, updates the README Releases section, and ships the Astro + Starlight docs site under site/. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
30 lines
1.3 KiB
Python
30 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
|
|
def test_book_session_and_tutorbot_ids_are_scoped_per_user(as_user) -> None:
|
|
from deeptutor.book.storage import BookStorage
|
|
from deeptutor.services.session import get_sqlite_session_store, get_turn_runtime_manager
|
|
from deeptutor.services.tutorbot.manager import TutorBotManager
|
|
|
|
tutorbot_manager = TutorBotManager()
|
|
shared_book_id = "shared-book-id"
|
|
|
|
with as_user("u_victim"):
|
|
victim_book_root = BookStorage().book_root(shared_book_id)
|
|
victim_session_db = get_sqlite_session_store().db_path
|
|
victim_runtime_store_db = get_turn_runtime_manager().store.db_path
|
|
victim_tutorbot_dir = tutorbot_manager._tutorbot_dir
|
|
|
|
with as_user("u_attacker"):
|
|
attacker_book_root = BookStorage().book_root(shared_book_id)
|
|
attacker_session_db = get_sqlite_session_store().db_path
|
|
attacker_runtime_store_db = get_turn_runtime_manager().store.db_path
|
|
attacker_tutorbot_dir = tutorbot_manager._tutorbot_dir
|
|
|
|
assert victim_book_root != attacker_book_root
|
|
assert victim_session_db != attacker_session_db
|
|
assert victim_runtime_store_db != attacker_runtime_store_db
|
|
assert victim_tutorbot_dir != attacker_tutorbot_dir
|
|
assert "u_victim" in str(victim_book_root)
|
|
assert "u_attacker" in str(attacker_book_root)
|