-
Notifications
You must be signed in to change notification settings - Fork 4
Safety and Trust Boundaries zh CN
语言: English · 简体中文
LWC 本地优先,但并不代表不存数据。其安全模型会明确区分规范知识、派生索引、部署配置、外部工具和 Agent 宿主等信任边界。安全与隐私取决于准确 scope、文件系统归属、最小持久内容和有界集成 surface。
可能敏感的持久数据包括:
- 完整 Source snapshot 与 observed origin path;
- Page body、title、summary、citation、provenance 与 link;
- Purpose、Schema、tag、strong-context policy 与 operation history;
- 被记录的 search wording 与
--reason; - retrieval weight 与 feedback metadata;
- checkpoint 与 sparse draft database;
- generated Markdown;
- CodeGraph symbol name 与 project file path;
- Agent integration receipt 与 owned host fragment。
Document-graph sidecar、FTS table、span、Viewer response 与 Hook context 都是这些授权状态的派生副本或视图。Derived 不代表不敏感。
LWC core storage、search、graph engine、Viewer 与 MCP 都在本地运行。Grafeo 和 SurrealDB 是 embedded engine,Viewer 使用内嵌资源并只绑定 loopback。
CodeGraph runtime 只有在显式初始化时才从固定 GitHub Release 下载,之后在本地运行并永久关闭 telemetry。可选 MarkItDown 与 AnyDoc 以本地 subprocess 运行,但仍受各自 upstream behavior 约束;转换敏感文档前要先审核这些工具。
Agent host 及其 model provider 是另一个 trust boundary。Agent 读取 Page 或 Hook context 后向已配置模型发送什么内容,不在 LWC 控制范围内。
以下 Source 和配置输入会因明显风险被拒绝:
- 非模板
.env文件; - private-key filename 或
.key、.p12、.pfxcredential file; - PEM、OpenSSH 或 PGP private-key marker;
- AWS、GitHub、OpenAI、Slack 等已知 credential prefix;
- 明确 conversion credential flag。
Scanner 刻意聚焦明显高风险 pattern,并不是 DLP system,无法识别所有客户 secret、password、private URL、session token 或 proprietary fact。
Ingest 前必须人工审核。不要为了接受一份真实 secret 而削弱 scanner。
禁止保存:
- raw hidden chain-of-thought 或 private model reasoning;
- transient build log 与大型 debug dump;
- credential、cookie、access token、private key 或 password;
- 超出项目授权分级的 customer data;
- 被写成事实的 unsupported guess;
-
--reason或可选 recorded search 中的敏感 query wording。
只保存简洁、已验证 conclusion、Source citation,以及未来工作真正需要的最小 evidence。
search、lint、Viewer 与 MCP 默认只读。只有显式要求记录时,search wording 才进入 operation log。
Retrieval feedback 保存 normalized query terms 的 SHA-256 fingerprint,不保存原 query;但它的 reason 是持久文本。Fingerprint 可以降低意外暴露,却不是 encryption,对已知 query 仍可能关联。
Strong-tag Hook context 会刻意全量载入选中的 Page。Autoload tag 必须保持小而精,禁止把 secret material 标记成全会话规则。
LWC 会校验 project containment,并拒绝 Store、config、draft runtime、Work、checkpoint、graph、materialization、conversion 与 CodeGraph path 中的不安全 symlink。
系统支持时,owned state file 使用受限 permission,并采用 atomic replacement 或 create-new 语义。lwc init 可以把 .lwc 加入仓库 local Git exclude;应验证仓库策略,而不是提交 runtime state。
本地文件系统权限仍是主要 confidentiality boundary。Backup、checkpoint、temp directory 与 crash report 必须得到和 wiki.db 相同的保护。
Agent-facing server 只暴露一个 read-only tool:lwc_explore:
- 每次 call 都提供 absolute project path;
- 拒绝 filesystem root 与 relative path;
- 验证 mode 与 limit;
- 缺失 graph capability 保持 unavailable,不会初始化;
- tool schema 拒绝 write-shaped additional property;
- CodeGraph 与 memory read 都限制在选中项目内。
Local stdio 之外的 MCP transport security 属于宿主职责。LWC 不开放 network MCP listener。
Lifecycle Hook 返回有界 readiness、strong-tag context 与 timing guidance,不会执行 graph initialization 或 conversion setup。
Instruction injection 使用 marker-bounded additive block。Target adapter 只拥有自己的 named MCP entry、Skill directory、recognizable Hook/plugin entry 和 marked Instructions。Receipt hash 可以防止 refresh/uninstall 默默覆盖后来 user edit。
Host trust prompt、UI permission 与 preview activation 保持 user-managed;只有存在官方窄文件 surface 时才自动配置。
Viewer:
- 只监听
127.0.0.1; - 只开放 GET/HEAD route;
- 没有 authentication,禁止公开反向代理;
- 清理 Markdown 并禁止 active embed;
- 应用 Content Security Policy、
frame-ancestors 'none'与nosniff; - 不初始化或修改索引。
同一主机的其他 process 仍可能访问端口。共享系统上查看后要及时停止。
默认情况下,LWC 会验证 project-contained input/output,使用 create-new Markdown output,强制 timeout 和 size bound,并且只在最终 safety check 通过后传递 configured adapter argument。
转换不会自动 ingest output。加入 Source 前要检查 prompt injection、恶意 link、异常遗漏与 secret exposure。
External input 必须显式允许。这个选项只扩大 source location,不扩大 output ownership 或 adapter argument authority。
通过 CLI 删除 Page 或 Source,无法清除 checkpoint、旧 draft database、filesystem backup、Agent transcript 或 remote repository history 中已有副本。
以下内容需要各自定义 retention:
- named checkpoint;
- failed 或 abandoned draft;
- generated Markdown backup;
- CodeGraph index;
- Agent host log 与 conversation;
- system backup。
不要把逻辑删除承诺成 cryptographic erasure。
禁止在 public issue 中包含可用 exploit、secret、private repository path 或 user data。使用仓库的 Security policy,并提供:
- affected version 与 platform;
- 被跨越的 trust boundary;
- 最小非敏感复现;
- canonical data、credential 或 host file 是否变化;
- 安全 cleanup 或 containment step;
- 是否需要 embargo。
启用 integration 或导入敏感证据前,确认:
- selected scope 与 project path 正确;
- data classification 允许本地以及 Agent/model access;
- content、argument、reason 或 log 中没有 secret;
- optional upstream tool behavior 可接受;
- filesystem 与 backup permission 足够;
- Hook/tag context 有界;
- uninstall 或 recovery 不会破坏 foreign data。
下一篇:发布与升级运维
LWC Wiki
- Home · 首页
- Project overview · 项目简介
- Basic concepts · 基本概念
- Use cases · 应用场景
- Installation and upgrades · 安装与升级
- Quick start · 快速开始
- Persistent memory · 持久记忆体系
- Agent workflow and memory policy · Agent 工作流与主动记忆策略
- Sources and ingestion · 来源与知识整合
- Wiki pages and provenance · Wiki 页面与来源证明
- Search and context · 搜索与上下文载入
- Document knowledge graph · 文档知识图(记忆图网)
- Code graph · 代码图
- Word graph · 词图
- Tags and strong context · 标签与强上下文
- Document conversion · 文档转换
-
MCP server and
lwc_explore· MCP 服务与lwc_explore - Skills, Hooks, and Instructions · Skills、Hooks 与 Instructions
- AgentTarget installation · AgentTarget 安装与集成
- Changesets · Changeset 原子变更
- Work system · Work 任务系统
- Checkpoints and rollback · Checkpoint、恢复与回滚
- Read-only Viewer · 只读可视化界面
- Architecture overview · 总体架构
- Storage and data model · 存储与数据模型
- Retrieval and indexing · 检索与索引设计
- Graph projection and performance · 图投影与性能设计
- MCP, Hooks, and AgentTarget design · MCP、Hook 与 AgentTarget 设计
- Safety and trust boundaries · 安全模型与信任边界
- Maintenance and diagnostics · 维护与诊断
- Troubleshooting and FAQ · 故障排查与常见问题
- Migration and compatibility · 迁移与版本兼容
- Support and issue reporting · 获取帮助与问题反馈
- CLI and configuration reference · CLI 与配置参考
- JSON output and error contract · JSON 输出与错误契约
- Limits and glossary · 系统限制与术语表
- Contributing and development · 贡献与开发指南
- Testing and release process · 测试与发布流程
- Wiki style guide · Wiki 编写规范