fix: constrain custom workspace paths#9328
Conversation
There was a problem hiding this comment.
Code Review
This pull request restricts absolute custom workspace paths to stay within the AstrBot workspaces directory, aligning their validation with relative paths. It updates workspace_path_to_root to enforce this boundary check and modifies the test suite to verify that absolute paths outside the workspaces root are rejected while absolute paths inside are accepted. There are no review comments, so no additional feedback is provided.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
astrbot-docs | 81b28af | Commit Preview URL Branch Preview URL |
Jul 20 2026, 08:28 AM |
Motivation
Description
workspace_path_to_root(astrbot/core/workspace.py) by resolving both absolute and relative inputs and rejecting paths that equal or fall outside the AstrBot workspaces root.tests/unit/test_chatui_project_service.pyto accept absolute custom workspaces only when they are inside the configured workspaces root and to add a test that rejects absolute paths outside the root.Testing
uv run --no-sync ruff format ...anduv run --no-sync ruff check ..., and these checks passed.uv run --no-sync pytest tests/unit/test_chatui_project_service.py, but test execution was blocked because the environment is missing thepytest_asynciotest dependency; therefore the updated unit tests could not be executed end-to-end in this environment.Codex Task
Summary by Sourcery
Constrain custom workspace paths so they cannot escape the configured AstrBot workspaces root, tightening filesystem containment for custom workspace configurations.
Bug Fixes:
Enhancements:
Tests: