本页跟踪 CoderClaw 的形式化安全模型(目前是 TLA+/TLC;根据需要会添加更多)。
注意:一些较旧的链接可能引用了以前的项目名称。
目标(北极星): 提供机器检查的论证,证明 CoderClaw 在明确假设下执行其 预期的安全策略(授权、会话隔离、工具门控和 配置错误安全)。
目前是什么: 一个可执行的、攻击者驱动的安全回归测试套件:
目前还不是什么: 证明”CoderClaw 在所有方面都是安全的”或完整 TypeScript 实现是正确的。
模型维护在一个单独的仓库中:vignesh07/coderclaw-formal-models。
目前,结果通过在本地克隆模型仓库并运行 TLC 来复现(见下文)。未来的迭代可能提供:
开始使用:
git clone https://github.com/vignesh07/coderclaw-formal-models
cd coderclaw-formal-models
# 需要 Java 11+(TLC 在 JVM 上运行)。
# 仓库内置了固定版本的 `tla2tools.jar`(TLA+ 工具)并提供 `bin/tlc` + Make 目标。
make <target>
声明: 在没有认证的情况下绑定到 loopback 之外可能使远程入侵成为可能 / 增加暴露;令牌/密码可以阻止未认证的攻击者(根据模型假设)。
make gateway-exposure-v2make gateway-exposure-v2-protectedmake gateway-exposure-v2-negative另见:模型仓库中的 docs/gateway-exposure-matrix.md。
声明: nodes.run 需要(a)节点命令允许列表加上声明的命令以及(b)配置时的实时批准;批准被令牌化以防止重放(在模型中)。
make nodes-pipelinemake approvals-tokenmake nodes-pipeline-negativemake approvals-token-negative声明: 配对请求遵守 TTL 和待处理请求上限。
make pairingmake pairing-capmake pairing-negativemake pairing-cap-negative声明: 在需要提及的群组上下文中,未授权的”控制命令”不能绕过提及门控。
make ingress-gatingmake ingress-gating-negative声明: 来自不同对等方的私信不会折叠到同一会话中,除非明确链接/配置。
make routing-isolationmake routing-isolation-negative这些是后续模型,围绕真实世界的故障模式(非原子更新、重试和消息扇出)提高保真度。
声明: 配对存储应该在交错情况下也强制执行 MaxPending 和幂等性(即”检查然后写入”必须是原子/加锁的;刷新不应创建重复项)。
这意味着:
MaxPending。对同一 (channel, sender) 的重复请求/刷新不应创建重复的活跃待处理行。
make pairing-race(原子/加锁的上限检查)make pairing-idempotencymake pairing-refreshmake pairing-refresh-racemake pairing-race-negative(非原子 begin/commit 上限竞争)make pairing-idempotency-negativemake pairing-refresh-negativemake pairing-refresh-race-negative声明: 摄入应在扇出过程中保持追踪关联,并在提供商重试下保持幂等。
这意味着:
如果提供商事件 ID 缺失,去重回退到安全键(例如,追踪 ID)以避免丢弃不同的事件。
make ingress-tracemake ingress-trace2make ingress-idempotencymake ingress-dedupe-fallbackmake ingress-trace-negativemake ingress-trace2-negativemake ingress-idempotency-negativemake ingress-dedupe-fallback-negative声明: 路由必须默认保持私信会话隔离,只有在明确配置时才折叠会话(渠道优先级 + 身份链接)。
这意味着:
identityLinks 应该只在明确链接的组内折叠,而不是跨不相关的对等方。
make routing-precedencemake routing-identitylinksmake routing-precedence-negativemake routing-identitylinks-negative