Skip to content

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io

docs(security): bring supported versions and CSP facts up to date

Jasonc54e9eaeed7c
diff --git a/SECURITY.md b/SECURITY.md
index 807ec6054..c5d043a52 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -6,10 +6,10 @@ Only the latest release of CC Switch receives security updates.
仅最新版本的 CC Switch 会收到安全更新。
-| Version / 版本 | Supported / 是否支持 |
-|----------------|---------------------|
-| Latest 3.x | ✅ Yes / 是 |
-| < 3.0 | ❌ No / 否 |
+| Version / 版本 | Supported / 是否支持 |
+|--------------------------------------------------|---------------------|
+| Latest release (currently 4.x) / 最新正式版(当前为 4.x) | ✅ Yes / 是 |
+| Any older release / 更早的任何版本 | ❌ No / 否 |
## Threat Model / 威胁模型
@@ -23,18 +23,18 @@ It does, however, run a **local HTTP proxy** whose listen address and port are u
### The bundled renderer is inside the trust boundary / 打包的渲染进程属于信任边界之内
-The bundled WebView renderer is treated as a trusted component. This is a **scoping decision, supported by the facts below rather than derived from them** — the facts are what make the decision checkable, and if any ceases to hold the decision must be revisited. Verified against v3.18.0:
+The bundled WebView renderer is treated as a trusted component. This is a **scoping decision, supported by the facts below rather than derived from them** — the facts are what make the decision checkable, and if any ceases to hold the decision must be revisited. Verified against v4.0.46:
-打包的 WebView 渲染进程被视为可信组件。这是一项**范围划定决策,由下列事实支撑,而非从中必然推出**——这些事实的作用是让该决策可被核验;一旦任一条不再成立,该决策必须重新评估。已针对 v3.18.0 核实:
+打包的 WebView 渲染进程被视为可信组件。这是一项**范围划定决策,由下列事实支撑,而非从中必然推出**——这些事实的作用是让该决策可被核验;一旦任一条不再成立,该决策必须重新评估。已针对 v4.0.46 核实:
1. **No remote executable content is loaded.** `frontendDist` is bundled at build time (`src-tauri/tauri.conf.json`); the codebase contains no `<iframe>`, no `<webview>`, and no remote script or stylesheet URL. The application *does* retrieve remote **data** — model pricing JSON and provider avatars — which CSP permits via `connect-src`/`img-src`; such data is treated as untrusted input, not as content.
前端资源在构建期打包,代码库中不存在 `<iframe>`、`<webview>` 或远程脚本/样式地址。应用**确实**会获取远程**数据**(模型定价 JSON、供应商头像),CSP 经 `connect-src`/`img-src` 允许之;此类数据按不可信输入对待,不作为内容。
-2. **CSP restricts script execution to bundled assets** — `script-src 'self'` (`src-tauri/tauri.conf.json`).
- CSP 将脚本执行限制在打包资源内。
+2. **CSP restricts script execution to bundled assets** — `script-src 'self'` plus exactly one `'sha256-…'` hash (`src-tauri/tauri.conf.json`). The hash pins the fixed theme-initialization inline script in `src/index.html`, which only reads the `cc-switch-theme` preference from `localStorage` and toggles the `dark` class before first paint. There is no `'unsafe-inline'`, `'unsafe-eval'`, nonce or remote origin in `script-src`.
+ CSP 将脚本执行限制在打包资源内:`script-src` 为 `'self'` 加恰好一个 `'sha256-…'` 哈希。该哈希固定的是 `src/index.html` 中的主题初始化内联脚本,它只从 `localStorage` 读取 `cc-switch-theme` 偏好,并在首次绘制前切换 `dark` class。`script-src` 中不含 `'unsafe-inline'`、`'unsafe-eval'`、nonce 或远程源。
3. **No dynamic code evaluation.** There is no `eval()` or `new Function()` anywhere under `src/`.
`src/` 下不存在 `eval()` 或 `new Function()`。
-4. **The single HTML sink never receives user-controlled content.** `src/components/ProviderIcon.tsx` uses `dangerouslySetInnerHTML` exactly once; the user-supplied `icon` field is used **solely as a lookup key** into a build-time icon table, never as content.
- 全库唯一的 `dangerouslySetInnerHTML` 位于 `src/components/ProviderIcon.tsx`;用户提供的 `icon` 字段**仅作为查表的键**用于构建期图标表,永不作为内容。
+4. **The single HTML sink never receives user-controlled content.** `src/components/ProviderIcon.tsx` uses `dangerouslySetInnerHTML` exactly once; the user-supplied `icon` field is used **solely as a lookup key** into a build-time icon table, never as content. (The session reader's entity decoder in `src/components/sessions/reader/SessionMarkdown.tsx` assigns `innerHTML` on a detached `<textarea>`, which the parser treats as RCDATA: it yields text only, creates no elements and is never attached to the document.)
+ 全库唯一的 `dangerouslySetInnerHTML` 位于 `src/components/ProviderIcon.tsx`;用户提供的 `icon` 字段**仅作为查表的键**用于构建期图标表,永不作为内容。(会话阅读器 `src/components/sessions/reader/SessionMarkdown.tsx` 的实体解码函数会对一个未挂载的 `<textarea>` 赋值 `innerHTML`;解析器按 RCDATA 处理,只产出文本、不创建元素,也从不挂进文档。)
**What this excludes — and what it does not.** Out of scope: reports whose only path to the IPC surface is **direct invocation from DevTools or from a locally modified frontend**. Someone in that position controls the machine already.
@@ -52,8 +52,8 @@ The scoping decision above is void the moment any of the following becomes true.
- Remote **executable or navigable** content is loaded into the WebView — iframe, webview, remote script, remote stylesheet, or navigation to a remote origin
远程**可执行或可导航**内容被载入 WebView——iframe、webview、远程脚本、远程样式表,或导航至远程源
-- `script-src` is relaxed beyond `'self'`
- `script-src` 被放宽到 `'self'` 之外
+- `script-src` is relaxed beyond `'self'` plus the single hash of the theme-initialization script in `src/index.html` (for example `'unsafe-inline'`, `'unsafe-eval'`, a nonce, a remote origin or another hash), or that inline script starts acting on anything other than the theme preference
+ `script-src` 被放宽到「`'self'` 加 `src/index.html` 主题初始化脚本的那一个哈希」之外(例如 `'unsafe-inline'`、`'unsafe-eval'`、nonce、远程源或其他哈希),或该内联脚本开始处理主题偏好以外的任何内容
- `eval()` or `new Function()` is introduced
引入 `eval()` 或 `new Function()`
- Any user-controlled string reaches an HTML sink as content