feat: add role-based Local computer permissions - #9472
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
astrbot-docs | 2871b34 | Commit Preview URL Branch Preview URL |
Sep 15 2026, 07:39 AM |
- Added `open_file_in_allowed_roots` function in `local_file_security.py` to securely open files within specified directories, preventing path traversal attacks. - Updated file reading functions in `file_read_utils.py` to accept file descriptors, allowing for safer file operations. - Enhanced `FileReadTool`, `FileWriteTool`, and `FileEditTool` to utilize the new secure file access method. - Added tests to ensure restricted access works correctly, including scenarios with symlinked directories and ancestor swaps. - Improved error handling for file operations to provide clearer feedback on permission issues.
…rap-shell-sandbox # Conflicts: # astrbot/core/tools/computer_tools/shell.py # tests/unit/test_func_tool_manager.py
RC-CHN
marked this pull request as ready for review
September 8, 2026 02:14
Contributor
There was a problem hiding this comment.
Sorry @RC-CHN, your pull request is larger than the review limit of 150,000 diff characters
Sandboxed processes can write to shared temp roots, so a named session log there could be replaced with a symlink to a host file that host-side reads and appends would follow. Keep managed shell output on an anonymous temporary file handle instead of a named path. Also stop _resolve_path_from_sandbox from consulting a booter under the local runtime: workspace and local-file checks already enforce caller permissions, and the fallback branch probed the host shell without them. Reject such paths with FileNotFoundError instead.
camera-2018
approved these changes
Sep 13, 2026
Contributor
|
@RC-CHN 冲突解一下 |
w31r4
approved these changes
Sep 15, 2026
w31r4
left a comment
Contributor
There was a problem hiding this comment.
勉强采用的方案, 隔离不充分不彻底, 凑合的 Beta 版本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
computer_use_require_adminwith an explicit role-based permission matrix for members and administratorscomputer_use_require_adminfor remote Sandbox runtimes only, with its existing semantics and a Sandbox-only dashboard controlDefault Local policy
The dashboard presents these permissions as a full-width Unix-style matrix directly below the Local runtime selector. Network access is disabled when execution is disabled, and elevated member access produces a visible warning.
The stored configuration remains explicit and forward-compatible:
Runtime behavior
allow_execution=falsedenies new Shell and Python execution for that role.allow_network=falseisolates the process network namespace/profile.filesystem_scope=workspacelimits Shell, Python, read, write, edit, grep, and local file sending to approved workspace, Skill, and temporary roots.allow_network=trueandfilesystem_scope=host) preserves direct Local execution.Linux requires
bwrapand functional unprivileged user namespaces for restricted policies. macOS requires/usr/bin/sandbox-exec. Apple markssandbox-execas deprecated, so this implementation remains isolated behind the Local permission boundary and covered by integration tests.Validation
uv run ruff format .uv run ruff check .ASTRBOT_ROOT: 3 passedpnpm exec vue-tsc --noEmitpnpm exec vite build