# 隐私与安全说明 / Privacy & Security
本文件是 **dsh-music-code-mv 插件本体**(`index.js`、`lib/`、`skill/scripts/`、`skill/template/`)的隐私审核记录,以及「改动渲染内核 / 配色后该怎么复查」的清单。
This is the privacy review record for the plugin itself, plus the checklist to re-run whenever the render kernel or palettes change.
审计 / audited: 2026-10-01 · 版本 version 0.2.x · 方式 method: 静态扫描 + 真起服务的行为断言(`test/privacy.test.mjs` + `test/studio.test.mjs`)
---
## 结论 / verdict
**插件不联网、不埋点、不读工程目录以外的文件。** 唯一对外开口是 DSH 自带 webServer 上的 `/music-mv/*`:只服务回环地址、不做跨域、只读已发现工程目录内的产物。
**No outbound traffic, no telemetry, no reads outside your projects.** The only surface is `/music-mv/*` on DSH's own webServer: loopback-only, no CORS, project-scoped reads.
## 数据流 / data flow
```
浏览器(DSH 界面,或直接用浏览器打开)
│ 同源 fetch + x-music-mv: studio
▼
DSH webServer (127.0.0.1) ── 前缀路由 /music-mv
│
├── 工程扫描:readdir 工作区内最多 3 层,只找 project.json + index.html
├── 文件预览:仅限已发现工程目录内、且非隐藏文件
└── 渲染任务:spawn 本机 node 跑 skill/scripts/render.mjs(子进程,无网络)
└── 无头 Chrome 打开本机 index.html 截帧 → ffmpeg 编码 → 写回工程 out/```
没有任何一步把数据送出本机;插件也不读取 DSH 会话、提示词、模型凭据。
---
## 发现与处置 / findings
| # | 严重度 | 问题 | 处置 |
|---|---|---|---|
| 1 | 高 | 工作室响应带 `Access-Control-Allow-Origin: *`。用户随手打开的任意网页都能 `fetch` 走工作区文件内容(回环 + 通配 CORS = 可被联动读取)。 | **已修**:不再发任何 ACAO;跨站请求按 `Sec-Fetch-Site` 拒绝;`/api` 需自定义头 `x-music-mv: studio`(跨域预检拿不到许可);响应加 `Cross-Origin-Resource-Policy: same-origin`。 |
| 2 | 高 | `/api/file`、`/api/text` 原先允许工作区内**任意**文件,凭据、无关源码都在可读范围。 | **已修**:只允许已发现工程目录内的文件;含隐藏段(`.env`、`.git`、`.cache`)一律 403;路径穿越 403。 |
| 3 | 中 | 没有来源地址检查。若 DSH 被绑到 `0.0.0.0`(局域网暴露),工作室会跟着暴露且无鉴权。 | **已修**:仅接受回环来源(`127.0.0.1` / `::1` / `::ffff:127.0.0.1`),非回环一律 403。 |
| 4 | 低 | 客户端用 `postMessage(..., '*')` 推主题,页面也不校验来源。 | **已修**:只发给 `location.origin`;页面只认 `ev.origin === location.origin` 的消息。 |
| 5 | 说明 | `
/