mirror of https://gitee.com/dromara/liteFlow
Task 3.1:把 liteflow ShellConfig(mode/whitelist/blacklist)翻译成 v2 PermissionContextState 的命令级规则,替代 1.0 在 ManagedShellCommandTool 内 手写的命令过滤。执行期由 v2 PermissionEngine 在工具调用前裁决。 探针(findings R6-ext,直接读 RC3 源码): - PermissionEngine 不解析 ruleContent;null/空=catch-all,非空完全委派 tool.matchRule(content, input)。RC3 core 无任何 ToolBase 子类覆写 matchRule,故 matcher DSL 由 Task 3.2 的自建工具定义。 - 默认裁决顺序:denyRules→askRules→工具自检→allowRules→BYPASS→default (DEFAULT=ASK,DONT_ASK=DENY)。有 allowRules 不隐含其余 deny。 ruleContent 约定(Task 3.1 + Task 3.2 共同): - 精确匹配首 token = 裸字符串(如 "ls") - catch-all = null 各 mode 映射: - DISABLED → DEFAULT + catch-all deny - WHITELIST → DONT_ASK + 每条白名单 allow(非白名单经 default 转 DENY; 不能用 catch-all deny——denyRules 先于 allowRules 会吞掉白名单) - BLACKLIST → DEFAULT + 每条黑名单 deny + catch-all allow 兜底 ReactAgentFactory.build 加 .permissionContext(PermissionConfigMapper.map(cfg))。 map() 永非 null(null/缺省/未识别枚举回退安全默认)。 校验:core compile SUCCESS;test-compile SUCCESS; PermissionConfigMapperTest 5/5(javac+JUnit Launcher,sibling 测试致模块 mvn test 不能跑,沿用 V2ApiProbe 手法);ProcessIntegrationTest 1/1 (permission 不破坏非 shell 调用)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| liteflow-react-agent-anthropic | ||
| liteflow-react-agent-core | ||
| liteflow-react-agent-dashscope | ||
| liteflow-react-agent-gemini | ||
| liteflow-react-agent-openai | ||
| pom.xml | ||