Skip to content

Commit cdc7ba7

Browse files
committed
feat(permissions): Approve read-only shell commands
Analyze commands using the selected shell and evaluate argument patterns per command, preserving file permissions and independent constraints. Add conservative read-only classification, directory flow tracking, native PowerShell AST parsing and bounded workspace glob expansion. Bind saved approvals to the command, shell, working directory and TTY. Update permission settings and command approval labels, and hide command analysis reasons from confirmation prompts. Keep legacy bash rules and exact grants readable. Validation: focused Rust permission, parser and pipeline tests; native PowerShell parsing; frontend tests and check:web; i18n and capability checks; repository hygiene and core boundaries. Remote behavior was covered with mocks, without live SSH, relay, peer or dispatch testing.
1 parent 653b346 commit cdc7ba7

42 files changed

Lines changed: 3316 additions & 46 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/interactive-capabilities/capabilities.json‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"title": "OpenBitFun Playbook",
55
"origin": "https://playbook.openbitfun.com",
66
"source": "src/shared/interactive-capabilities/catalog.json",
7-
"digest": "95af08a07e006197f38bc56624636046d2b825a055cc28cc341f4024c49ff8e6",
7+
"digest": "ac2c3878058ed38177469e1dc73e4a774859c4d9bcbc6c9a28477e63710d6d07",
88
"ownerDigest": "1fdb9c49d404c02483c08e1e0fe9effa0aaa4f0f2914578bcaa63e04de16cc16",
99
"searchAcceptance": [
1010
{
@@ -33416,8 +33416,8 @@
3341633416
"id": "default-permission-posture",
3341733417
"titleZh": "在需要确认(默认)、自动审批与完全访问三种默认权限模式间切换",
3341833418
"titleEn": "Switch the default permission mode between Ask (default), Auto-approve, and Full access",
33419-
"descriptionZh": "“需要确认”默认放行普通工作区编辑、常规查询、任务调度和会话间消息,对命令执行、删除、敏感文件和发布操作保持人工把关;“自动审批”先由模型评估风险;“完全访问”需二次确认高风险提示,跳过常规询问但依然遵守产品底层硬性安全限制。",
33420-
"descriptionEn": "Ask allows ordinary workspace edits, routine queries, scheduling, and messages between sessions, while keeping commands, deletions, sensitive files, and publishing subject to confirmation; Auto-approve screens calls with an AI reviewer first; Full access requires confirming a risk warning and skips routine prompts while keeping hard product safety limits intact.",
33419+
"descriptionZh": "“需要确认”默认放行普通工作区编辑、已识别的只读命令、任务调度和会话间消息,对其他命令、删除、敏感文件和发布操作保持人工把关;“自动审批”先由模型评估风险;“完全访问”需二次确认高风险提示,跳过常规询问但依然遵守产品底层硬性安全限制。",
33420+
"descriptionEn": "Ask allows ordinary workspace edits, recognized read-only commands, scheduling, and messages between sessions, while keeping other commands, deletions, sensitive files, and publishing subject to confirmation; Auto-approve screens calls with an AI reviewer first; Full access requires confirming a risk warning and skips routine prompts while keeping hard product safety limits intact.",
3342133421
"control": {
3342233422
"kind": "open",
3342333423
"reasonCode": "unstructuredInteraction",
@@ -33493,12 +33493,14 @@
3349333493
"tipsZh": [
3349433494
"“自动审批”模式下,只有默认设为“自动审批”时下方的模型类型、超时与回退下拉框才可编辑;若在远程控制或手机端使用,建议将“不确定时”和“出错时”保留为“询问”,这样远端也能收到审批卡片而不会静默失败。",
3349533495
"填写专用决策模型(Jev)的 API Key 后,记得点击输入框右侧的保存图标写入主机加密凭据库;清空密钥同理点击删除图标。",
33496-
"即使开启“完全访问”,OpenBitFun 内置的产品级硬性安全边界依然生效;项目级规则可在具体工作区中覆盖全局规则。"
33496+
"即使开启“完全访问”,OpenBitFun 内置的产品级硬性安全边界依然生效;项目级规则可在具体工作区中覆盖全局规则。",
33497+
"命令规则选择 process.execute,并用 git clone * 这样的参数模式匹配已解析的单条命令;尾部 * 不会跨过 &&、管道或重定向。其他命令和文件访问仍分别检查;无法解析的命令继续请求确认。已有 bash 规则仍可使用。"
3349733498
],
3349833499
"tipsEn": [
3349933500
"The Auto-approve screener, timeout, and fallback controls become editable once the default mode is set to Auto-approve; keeping both fallbacks on Ask ensures mobile or Remote Connect sessions can still approve edge cases interactively.",
3350033501
"After typing a dedicated Jev decision-model API key, click the Save icon beside the password box to store it in the host encrypted credential vault.",
33501-
"Even in Full access mode, hard product safety boundaries remain enforced, and project-scoped rules can still refine global defaults."
33502+
"Even in Full access mode, hard product safety boundaries remain enforced, and project-scoped rules can still refine global defaults.",
33503+
"Use process.execute with an argument pattern such as git clone * to match a parsed command. A trailing * does not span &&, pipelines, or redirections. Other commands and file accesses are checked separately; unsupported syntax still asks for approval. Existing bash rules remain usable."
3350233504
],
3350333505
"agentExamplesZh": [
3350433506
"打开权限规则设置,我想开启自动审批",

‎docs/interactive-capabilities/capabilities/setting.ai.permissions.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Set the default safety posture for agent tool calls (Ask, Auto-approve, or Full
2828

2929
- **智能体可定位入口,需交互完成 / Agent opens; interaction required** · 在需要确认(默认)、自动审批与完全访问三种默认权限模式间切换
3030
- Switch the default permission mode between Ask (default), Auto-approve, and Full access
31-
- 说明:“需要确认”默认放行普通工作区编辑、常规查询、任务调度和会话间消息,对命令执行、删除、敏感文件和发布操作保持人工把关;“自动审批”先由模型评估风险;“完全访问”需二次确认高风险提示,跳过常规询问但依然遵守产品底层硬性安全限制。
32-
- Why & how: Ask allows ordinary workspace edits, routine queries, scheduling, and messages between sessions, while keeping commands, deletions, sensitive files, and publishing subject to confirmation; Auto-approve screens calls with an AI reviewer first; Full access requires confirming a risk warning and skips routine prompts while keeping hard product safety limits intact.
31+
- 说明:“需要确认”默认放行普通工作区编辑、已识别的只读命令、任务调度和会话间消息,对其他命令、删除、敏感文件和发布操作保持人工把关;“自动审批”先由模型评估风险;“完全访问”需二次确认高风险提示,跳过常规询问但依然遵守产品底层硬性安全限制。
32+
- Why & how: Ask allows ordinary workspace edits, recognized read-only commands, scheduling, and messages between sessions, while keeping other commands, deletions, sensitive files, and publishing subject to confirmation; Auto-approve screens calls with an AI reviewer first; Full access requires confirming a risk warning and skips routine prompts while keeping hard product safety limits intact.
3333
- **智能体可定位入口,需交互完成 / Agent opens; interaction required** · 为自动审批选择聊天审查模型或专用 Jev 决策模型并加密保存凭据
3434
- Choose a chat screener model or dedicated Jev decision model for auto-approval with encrypted credentials
3535
- 说明:聊天模型模式默认优先选用“快速模型”(亦可改为“主模型”或任一已启用模型);专用决策模型模式默认使用 jev-latest,其 API Key 仅加密保存在当前执行主机。
@@ -89,6 +89,8 @@ Set the default safety posture for agent tool calls (Ask, Auto-approve, or Full
8989
- After typing a dedicated Jev decision-model API key, click the Save icon beside the password box to store it in the host encrypted credential vault.
9090
- 即使开启“完全访问”,OpenBitFun 内置的产品级硬性安全边界依然生效;项目级规则可在具体工作区中覆盖全局规则。
9191
- Even in Full access mode, hard product safety boundaries remain enforced, and project-scoped rules can still refine global defaults.
92+
- 命令规则选择 process.execute,并用 git clone * 这样的参数模式匹配已解析的单条命令;尾部 * 不会跨过 &&、管道或重定向。其他命令和文件访问仍分别检查;无法解析的命令继续请求确认。已有 bash 规则仍可使用。
93+
- Use process.execute with an argument pattern such as git clone * to match a parsed command. A trailing * does not span &&, pipelines, or redirections. Other commands and file accesses are checked separately; unsupported syntax still asks for approval. Existing bash rules remain usable.
9294

9395
关联条目 / Related: `setting.tools.execution`, `setting.ai.models`, `feature.ai-assistant`, `feature.remote-connect`
9496

‎docs/interactive-capabilities/technical/product-control-open-audit.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"schemaVersion": 1,
33
"generatedFrom": "src/shared/interactive-capabilities/catalog.json",
4-
"catalogDigest": "95af08a07e006197f38bc56624636046d2b825a055cc28cc341f4024c49ff8e6",
4+
"catalogDigest": "ac2c3878058ed38177469e1dc73e4a774859c4d9bcbc6c9a28477e63710d6d07",
55
"count": 231,
66
"reasonCounts": {
77
"externalAuth": 4,

‎docs/interactive-capabilities/technical/tauri-command-map.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"schemaVersion": 2,
33
"generatedFrom": "src/shared/interactive-capabilities/catalog.json",
4-
"catalogDigest": "95af08a07e006197f38bc56624636046d2b825a055cc28cc341f4024c49ff8e6",
4+
"catalogDigest": "ac2c3878058ed38177469e1dc73e4a774859c4d9bcbc6c9a28477e63710d6d07",
55
"commandCount": 702,
66
"coverage": {
77
"commandCount": 702,

‎src/crates/assembly/core/src/agentic/execution/edit_constraint_guard.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ mod shell_targets;
2929
pub use complete_shell::check_exec_command;
3030
#[cfg(test)]
3131
pub(crate) use complete_shell::check_with_state as check_shell_with_state;
32+
pub(crate) use complete_shell::resolved_candidates as inspect_shell_permission_path;
3233

3334
pub(crate) async fn has_active_shell_constraints(context: &ToolUseContext) -> bool {
3435
complete_shell::active_state(context).await.is_some()

‎src/crates/assembly/core/src/agentic/execution/edit_constraint_guard/complete_shell.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub(crate) async fn check_with_state(
135135
None
136136
}
137137

138-
async fn resolved_candidates(
138+
pub(crate) async fn resolved_candidates(
139139
context: &ToolUseContext,
140140
path: &str,
141141
) -> Result<Vec<String>, &'static str> {

‎src/crates/assembly/core/src/agentic/tools/framework.rs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,18 @@ pub trait Tool: Send + Sync {
149149
}
150150
}
151151

152+
/// Host-aware, non-executing preparation after input validation and Hook rewrites.
153+
async fn prepare_permission_intents(
154+
&self,
155+
input: &Value,
156+
context: &ToolUseContext,
157+
) -> OpenBitFunResult<Vec<PermissionIntent>> {
158+
self.permission_intents(input, context)
159+
}
160+
161+
/// Release invocation-owned host selections after completion or cancellation.
162+
async fn release_permission_preparation(&self, _input: &Value, _context: &ToolUseContext) {}
163+
152164
/// Whether this tool manages its own execution timeout (for example via the
153165
/// subagent timeout handle) and should not be wrapped by the global tool
154166
/// pipeline timeout.

0 commit comments

Comments
 (0)