Repository navigation
feat(build): 记录工作区信任,未信任时拒绝会运行项目代码的构建计划 - #118
Merged
Merged
Conversation
… code in untrusted workspaces The toolchain catalog records a decision on each workspace as IntelliJ IDEA does: trusted, distrusted (kept in safe mode) or unknown, plus trusted locations whose every workspace is trusted. catalogState reports the state, the location that trusts the workspace and the parent folder a prompt may offer; editCatalog records trust, safe mode, or trust with the parent folder. Plan requests take projectCodeAllowed. Without it Core refuses with plugin.build.untrustedWorkspace every task, test, run configuration, before-launch task, run and debug preparation, a model or dependency command declaring executesProjectCode, and a request to a provider declaring it. Run entries from a decoded model and test discovery decoding need no trust. The contract replaces "Lithe has no workspace trust state" with a Workspace trust section and documents the new code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…quests The SDK scenarios plan builds of their own fixture workspaces, which they trust: models, tasks, tests and run preparations of the sample providers run the workspace's code, so Core now refuses them without projectCodeAllowed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1lck
marked this pull request as ready for review
November 19, 2026 12:05
1lck
added a commit
that referenced
this pull request
Nov 19, 2026
…changelog (#119) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 20, 2026
xiaoyumuxi
added a commit
that referenced
this pull request
Nov 20, 2026
toolchains.editCatalog 新增 trustedLocations: {add?, remove?},供没有打开工作区的设置页增删可信位置:按平台大小写身份匹配,删除不存在的位置不算修改,已存在的位置保留原有写法,工作区上的明确决定不受影响。添加文件系统根目录(/、盘符、UNC 共享)返回 plugin.toolchain.rootLocation;手写进文档的根目录位置在读取时被拒绝,工作区保持安全模式。信任列表超过 256 项改为返回 plugin.toolchain.trustListFull(含原来 workspaceTrust 的超限),宿主可以提示“列表已满”而不是“文档无效”。offered_location 改用 paths::is_root 判断根目录。schema 补上 #118 漏掉的 distrustedWorkspaces 和 trustedLocations。
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.
关联 Issue / Linked issue
PR 类型 / Type
改动说明
打开项目时,构建插件会运行 Maven 等工具加载模型,pom 里的扩展和插件就是仓库代码。契约原先写着“Lithe 没有工作区信任状态,逐次征求同意”,但桌面端打开项目就加载模型,没有任何询问。本 PR 按 IntelliJ IDEA 社区版的做法(
TrustedProjects.getProjectTrustedState、TrustedProjectsDialog.confirmOpeningOrLinkingUntrustedProject)补上信任状态,并由 Core 决定哪些计划需要信任。信任状态(
toolchains.catalogState/toolchains.editCatalog)trustedWorkspaces之外,新增distrustedWorkspaces(选了安全模式的工作区)和trustedLocations(其下任意深度的工作区都受信任)。新字段只在用到时写入,没有这些决定的用户,旧宿主照常能读。workspaceRoot的catalogState返回workspaceTrust: {state: trusted|distrusted|unknown, location, offeredLocation},projectCodeAllowed等于state == trusted。offeredLocation是询问时可一并信任的上级目录;上级是文件系统根(/、盘符、UNC 共享)时为null,避免一次信任整个卷。editCatalog的workspaceTrust增加location。trusted: true记为信任;trusted: false改为记录安全模式,原先是从名单删除,对projectCodeAllowed的效果相同;location: true同时信任上级目录。计划按信任把关(
build.*Plan)projectCodeAllowed(缺省为false),runConfigurationPlan和beforeLaunchTaskPlan的请求也加上它。plugin.build.untrustedWorkspace拒绝:所有任务、测试、运行配置、启动前任务、运行准备和调试准备(它们就是在运行项目);声明了executesProjectCode: true的模型或依赖命令;以及发给声明了该标记的构建提供者的请求。executesProjectCode: false的模型或依赖命令(例如go list)不受信任限制;从已解码模型列出运行项、以及build.decodeTestDiscovery借测试计划检查选择器能否运行,都不返回计划,也不受限。PlanContext的plan_with_arguments和provider_plan两个出口;provider_plan改为返回Validation。契约与文档
plugin.build.untrustedWorkspace。原先三处“没有工作区信任状态”的说法(启动方式、插件页面、后端激活)改为指向该节。rust-core-api.md更新计划公共字段、两个运行类请求、catalogState和editCatalog;后端指南和domains/backend.md的中英文同步更新。build-plans.json的计划请求显式带上projectCodeAllowed;Go 的模型计划改为false,演示无需信任;新增两个拒绝用例。toolchain-global-catalog.json新增“记录安全模式”和“受信任位置覆盖下层工作区”两个用例。验证
cargo test -p lithe-build -p lithe-execution -p lithe-toolchain -p lithe-core -p lithe-plugin-manifest -p lithe-plugin-output-links -p lithe-plugin-marketplace -p lithe-plugin-web-content(affected-crates.mjs列出的全部 crate)在 macOS ARM64 上全部通过。catalog::tests三个:状态在“未决定 / 安全模式 / 信任”之间转换;受信任位置覆盖下层但不覆盖同名前缀的兄弟目录,显式安全模式优先;文件系统根不提供上级目录。macOS 和 Windows 路径各测一次。provider_requests_that_run_project_code_need_a_trusted_workspace。cargo clippy -D warnings、cargo fmt --check、verify-rust-core-comments.sh build toolchain、verify-platform-tests.mjs、shared/plugins/scripts/verify-docs.mjs都通过。sdk-e2e.mjs。宿主须同时在计划请求里传入projectCodeAllowed,配套桌面 PR 升级PINNED_CORE_REVISION后验收。🤖 Generated with Claude Code