Repository navigation
f0.7++
aiduMEI f0.7++ · 爱嘟优忆思
钥匙强制下,每个 agent 连事实层也只看得到自己的。 包版本 0.7.5(f0.7+ 之上的第二轮外部审计 P0 收口)。
主要变化
- 事实层按身份隔离:开了
AIDUMEI_AGENT_KEY_ENFORCE=1的「一 agent 一钥匙」部署里,GET /api/facts等事实读路由此前仍可能读到别的身份和default的事实;现在钥匙强制即视为租户模式——主人身份(DEFAULT_USER_ID)看自己的 + 未认领的旧行,其余身份只看自己的,越界 403。 /opinions/set核事实真实归属:事实不在调用方名下一律 404,不能再往别人的事实上写观点。- 原则 7 补漏:在去掉零宽字符、全角转半角的视图上重扫;
DB_PASSWORD=、XXX_API_KEY=这类下划线前缀键名;全大写 / 纯小写口令、JSON 里的凭据、「是:」写法;记忆元数据也打码。/evolve/feedback的 query / correction 入库前打码。 - 凭据比较改字节比较:主 token、
X-API-Token、控制台口令、MCP SSE 都按 UTF-8 字节比较,中文口令不再 500。 - 删除真删:
reflections、memory_edits、autodream_log、opinions、facts_dedup_quarantine进入删除矩阵;单删时无租户列的表必须先确认属于本人才删;新增元守卫静态扫描,新表不登记删除裁决就过不了测试。 - 写入闸门不再被结构绕过:多模态 list-content 只取文本段、杂键丢弃;
auto_memory与/update走同一道闸门。 - 启动告警:配了 agent 钥匙却没开强制、或主 token 未绑定身份时提示。
升级提示
- 先备份(
bash scripts/backup_gate.sh create pre-f07pp)。 git pull→pip install -r requirements.txt→ 重启。- 用 agent 钥匙的部署:确认
AIDUMEI_AGENT_KEY_ENFORCE=1、主 token 已绑定身份,启动日志没有告警。 - 删除残留(旧版本单删后留在 reflections 等表里的正文)不会自动清,可按需人工处理。
测试
收集 4054(行为 3426 + 脚本/钩子 482 + 守卫 146),新增 47 条(每个绕过样例修复前都能复现);4020 通过,其余为跳过与两项环境相关用例(crontab、硬链接)。回归门(公开虚构集)mem0 / native 均 164/171 = 0.9591,逐类不变。
完整变更见 CHANGELOG。
English. f0.7++ (package 0.7.5) closes the P0 findings of a second outside audit on f0.7+: under agent-key enforcement the facts layer is now tenant-isolated (the owner identity sees its own plus unclaimed rows, other identities only their own); /opinions/set checks the fact's real owner; write-policy principle 7 covers zero-width/full-width tricks, underscore-prefixed keys, passphrase and JSON forms, and metadata; /evolve/feedback is redacted before storage; credentials are compared as bytes (non-ASCII no longer 500); the delete chain covers reflections, memory_edits, autodream_log, opinions and facts_dedup_quarantine with a static meta-guard; multimodal list-content, extra message keys, auto_memory and /update go through the same write gate. 4054 tests collected (47 new), 4020 pass; public regression baselines unchanged at 0.9591.