- 归档 OnlyOffice live bridge、Page AI、mindmap、design governance 与相关 bug 条目 - 补齐 MinerU OCR 后端 runtime 合同与 smoke/test 基线 - 收口 ChatOnly/Doubao、ObjectIdentity、Page Aggregate compat 与 runtime owner 文档口径 验证: - cargo test --manifest-path rust/Cargo.toml -p mnote-web local_ocr -- --test-threads=1 - cargo test --manifest-path rust/Cargo.toml -p mnote-web onlyoffice_bridge -- --test-threads=1 - git diff --check - git diff --cached --check - codegraph index . --force && codegraph status . - codegraph sync . && codegraph status .
3.5 KiB
3.5 KiB
7-50 ONLYOFFICE session.current 诊断工具缺少 resource scope 过滤
状态
- 状态:done
- Owner:07-ai / OnlyOffice live bridge / Hermes tools
- 发现时间:2026-06-01
现象
mnote.onlyoffice.session.current 是诊断工具,不会执行读写动作;但它在未传 onlyofficeSessionId / bridgeSessionId 时仍会 fallback 到进程内最近活跃 OnlyOffice bridge session,并返回 sessionId、documentId、assetId、fileType、pending command/result 计数等元数据。
这与读写工具已经要求 explicit session + aiAccessScope.allowedResourceIds 的收口方向不完全一致。若 Page AI 当前 target=A,但进程内最近活跃 Office session 属于 resource=B,模型可能通过 session.current 看到 B 的 session 元数据。
证据
rust/crates/mnote-web/src/hermes_tools/onlyoffice_live.rs中session_current()允许缺 session id 时使用current_session_info()。rust/crates/mnote-web/src/routes/onlyoffice_bridge.rs中current_session_info()返回全局最近活跃 session。- Reasonix 只读复核
reasonix-2026-05-31T16-38-36-472Z-63f3a41c判断:这不是写绕过,但属于低级信息泄漏风险;建议session_current也加入 scope 校验或过滤返回字段。
影响
- 不会直接写入或读取文档正文,因此风险低于
7-45/7-46。 - 可能暴露非当前 target resource 的 Office session 元数据,给后续工具调用或模型选择目标带来混淆。
- 与 OnlyOffice live bridge 的最小权限口径不一致。
修复建议
session_current若传 explicit session id,应校验该 session 对应的sessionId/documentId/assetId/resource:office:{documentId}:{assetId}是否在aiAccessScope.allowedResourceIds中。session_current若未传 explicit session id,不应返回全局最近活跃 session;可以改为返回mnote_onlyoffice_session_explicit_required,或只在 debug/admin 边界允许。- 如果保留诊断 fallback,至少过滤
documentId/assetId等跨 resource 元数据,并在 manifest 标注只用于诊断。
本轮处理
- 2026-06-01:
mnote.onlyoffice.session.current已改为复用resolve_explicit_session_id()与ensure_onlyoffice_resource_scope_allowed()。 - 已删除
onlyoffice_bridge::current_session_info()全局最近 session fallback,避免诊断工具继续返回非当前 target 的 session 元数据。 manifest.rs中mnote.onlyoffice.session.current已复用 OnlyOffice live 工具 schema,要求aiAccessScope.allowedResourceIds,并通过anyOf要求onlyofficeSessionId或bridgeSessionId。scripts/task515-onlyoffice-live-scope-http-smoke.js已扩展覆盖session.current缺 explicit session 返回 400、scope 不匹配返回 403、授权 scope 返回 session 元数据。
验收
- Rust 单测覆盖 target=A 的
aiAccessScope.allowedResourceIds不能通过session.current获取 resource=B 的 session 元数据。 - 缺 explicit session id 的
session.current不再返回全局最近 session。 task515HTTP smoke 覆盖session.currentscope 边界。
验证:
cargo test --manifest-path rust/Cargo.toml -p mnote-web --lib hermes_tools_onlyoffice_session_current -- --test-threads=1cargo test --manifest-path rust/Cargo.toml -p mnote-web --lib hermes_tools_manifest_describes_onlyoffice_live_scope -- --test-threads=1node --check scripts/task515-onlyoffice-live-scope-http-smoke.jsnode scripts/task515-onlyoffice-live-scope-http-smoke.js