Skip to content

Commit 43c33bf

Browse files
authored
Merge pull request #23 from tytsxai/main
security: 修复多个 P0 级安全漏洞
2 parents 0859a01 + 084c1a6 commit 43c33bf

73 files changed

Lines changed: 2100 additions & 485 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/settings.local.json

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
{
22
"permissions": {
33
"allow": [
4-
"Bash(npm run format:*)",
5-
"Bash(npm run lint)",
6-
"Bash(npx tsc:*)",
7-
"Bash(cargo test:*)",
8-
"Bash(cargo build:*)",
9-
"Bash(npm run check:*)",
10-
"Bash(npm run:*)",
11-
"Bash(tree:*)",
12-
"Bash(find:*)",
13-
"Bash(cargo check:*)",
14-
"Bash(rm:*)",
15-
"Bash(cargo clippy:*)",
16-
"Bash(cargo fmt:*)",
17-
"Bash(lsof:*)",
18-
"Bash(xargs kill:*)",
19-
"Bash(cargo run:*)"
4+
"Bash",
5+
"Read(*)",
6+
"Write(*)",
7+
"Edit(*)",
8+
"MultiEdit(*)",
9+
"Glob(*)",
10+
"Grep(*)",
11+
"Task(*)",
12+
"TaskOutput(*)",
13+
"LSP(*)",
14+
"NotebookEdit(*)",
15+
"TodoWrite(*)",
16+
"AskUserQuestion(*)",
17+
"EnterPlanMode(*)",
18+
"ExitPlanMode(*)",
19+
"KillShell(*)",
20+
"WebFetch(domain:*)",
21+
"Skill(*)",
22+
"SlashCommand(*)"
2023
],
2124
"deny": [],
22-
"ask": []
25+
"defaultMode": "bypassPermissions"
2326
}
2427
}

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,17 @@ jobs:
4747
- name: Check Rust build
4848
working-directory: src-tauri
4949
run: cargo check --all-targets
50+
51+
- name: Lint frontend
52+
run: npm run lint
53+
54+
- name: Test frontend
55+
run: npm test
56+
57+
- name: Clippy
58+
working-directory: src-tauri
59+
run: cargo clippy --all-targets
60+
61+
- name: Test Rust
62+
working-directory: src-tauri
63+
run: cargo test

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ jobs:
9797
```
9898
9999
### 默认配置
100-
- **端口**: 3001
101-
- **API Key**: proxycast-key
100+
- **端口**: 8999
101+
- **API Key**: 首次启动自动生成,可在设置页查看/修改
102102
releaseDraft: false
103103
prerelease: false
104104
args: --target ${{ matrix.target }}

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
- **Per-Key 代理** - 为每个凭证单独配置代理
7575

7676
### 🔐 安全与管理
77-
- **TLS/HTTPS 支持** - 可选启用 HTTPS 加密通信
77+
- **HTTPS 部署** - 当前版本不内置 TLS,请使用反向代理进行 HTTPS 终止
7878
- **远程管理 API** - 通过 API 远程管理配置和凭证
7979
- **访问控制** - 支持 localhost 限制和密钥认证
8080

@@ -88,8 +88,12 @@
8888
- `/v1/models` - 模型列表
8989
- `/v1/messages` - Anthropic Messages API
9090
- `/v1/messages/count_tokens` - Token 计数
91+
- `/health` - 健康检查
92+
- `/ready` - 就绪检查
9193
- `/api/provider/{provider}/v1/*` - Provider 路由
9294
- `/v0/management/*` - 远程管理 API
95+
- `/v0/management/backup` - 触发数据库备份
96+
- `/v0/management/restore` - 从备份恢复
9397

9498
---
9599

@@ -135,20 +139,29 @@
135139
3. **启动服务** - 在 Dashboard 点击"启动服务器"
136140
4. **配置客户端** - 在 Cherry-Studio、Cline 等工具中配置:
137141
```
138-
API Base URL: http://localhost:3001/v1
139-
API Key: proxycast-key
142+
API Base URL: http://localhost:8999/v1
143+
API Key: 启动时自动生成的密钥(可在设置页查看/修改)
140144
```
141145

142146
---
143147

148+
## 🧰 运维提示
149+
150+
- **自动备份**:数据库默认每天自动备份到 `~/.proxycast/backups/`,保留 7 天。
151+
- **配置备份**:每次写入配置会生成 `config.yaml.backup` 以便回滚。
152+
- **日志归档**:7 天游离线日志自动压缩,30 天前压缩日志自动清理。
153+
- **生产 HTTPS**:当前版本不内置 TLS,生产环境需反向代理终止 HTTPS。
154+
155+
---
156+
144157
## 🔧 API 使用示例
145158

146159
### OpenAI Chat Completions
147160

148161
```bash
149-
curl http://localhost:3001/v1/chat/completions \
162+
curl http://localhost:8999/v1/chat/completions \
150163
-H "Content-Type: application/json" \
151-
-H "Authorization: Bearer proxycast-key" \
164+
-H "Authorization: Bearer your-api-key" \
152165
-d '{
153166
"model": "claude-sonnet-4-5-20250514",
154167
"messages": [
@@ -161,9 +174,9 @@ curl http://localhost:3001/v1/chat/completions \
161174
### Anthropic Messages API
162175

163176
```bash
164-
curl http://localhost:3001/v1/messages \
177+
curl http://localhost:8999/v1/messages \
165178
-H "Content-Type: application/json" \
166-
-H "x-api-key: proxycast-key" \
179+
-H "x-api-key: your-api-key" \
167180
-H "anthropic-version: 2023-06-01" \
168181
-d '{
169182
"model": "claude-sonnet-4-5-20250514",

docs/TECH_SPEC.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ src/
8585
### 路由模式
8686

8787
```
88-
http://localhost:3000/{provider}/v1/chat/completions
89-
http://localhost:3000/{provider}/v1/messages
88+
http://localhost:8999/{provider}/v1/chat/completions
89+
http://localhost:8999/{provider}/v1/messages
9090
```
9191

9292
### 支持的端点
@@ -104,8 +104,8 @@ http://localhost:3000/{provider}/v1/messages
104104
{
105105
"server": {
106106
"host": "127.0.0.1",
107-
"port": 3000,
108-
"apiKey": "proxycast-key"
107+
"port": 8999,
108+
"apiKey": "your-api-key"
109109
},
110110
"providers": {
111111
"kiro": {

docs/content/01.introduction/3.quickstart.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ProxyCast 会自动检测本地的 AI 客户端凭证文件。
4646

4747
1. 在仪表盘点击 **启动服务**
4848
2. 服务状态变为"运行中"
49-
3. 记下 API 地址(默认 `http://127.0.0.1:9090`
49+
3. 记下 API 地址(默认 `http://127.0.0.1:8999`
5050

5151
## 步骤 4: 测试 API
5252

@@ -61,7 +61,7 @@ ProxyCast 会自动检测本地的 AI 客户端凭证文件。
6161
**OpenAI 格式:**
6262

6363
```bash
64-
curl http://127.0.0.1:9090/v1/chat/completions \
64+
curl http://127.0.0.1:8999/v1/chat/completions \
6565
-H "Content-Type: application/json" \
6666
-H "Authorization: Bearer your-api-key" \
6767
-d '{
@@ -73,7 +73,7 @@ curl http://127.0.0.1:9090/v1/chat/completions \
7373
**Claude 格式:**
7474

7575
```bash
76-
curl http://127.0.0.1:9090/v1/messages \
76+
curl http://127.0.0.1:8999/v1/messages \
7777
-H "Content-Type: application/json" \
7878
-H "x-api-key: your-api-key" \
7979
-H "anthropic-version: 2023-06-01" \
@@ -90,7 +90,7 @@ curl http://127.0.0.1:9090/v1/messages \
9090

9191
在 Cursor 设置中配置 OpenAI API:
9292

93-
- API Base URL: `http://127.0.0.1:9090/v1`
93+
- API Base URL: `http://127.0.0.1:8999/v1`
9494
- API Key: 你在 ProxyCast 中设置的 API Key
9595

9696
### Continue 配置
@@ -103,7 +103,7 @@ curl http://127.0.0.1:9090/v1/messages \
103103
"title": "ProxyCast Claude",
104104
"provider": "openai",
105105
"model": "claude-sonnet-4-20250514",
106-
"apiBase": "http://127.0.0.1:9090/v1",
106+
"apiBase": "http://127.0.0.1:8999/v1",
107107
"apiKey": "your-api-key"
108108
}]
109109
}

docs/content/02.user-guide/1.dashboard.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ navigation:
2929

3030
服务运行时显示:
3131

32-
- **API 地址**: 本地 API 端点(如 `http://127.0.0.1:9090`
32+
- **API 地址**: 本地 API 端点(如 `http://127.0.0.1:8999`
3333
- **API Key**: 当前配置的访问密钥
3434
- **复制按钮**: 一键复制 API 地址或 Key
3535

docs/content/02.user-guide/11.skills.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ coding:
101101
### 通过 API 调用
102102
103103
```bash
104-
curl http://127.0.0.1:9090/v1/chat/completions \
104+
curl http://127.0.0.1:8999/v1/chat/completions \
105105
-H "Content-Type: application/json" \
106106
-H "Authorization: Bearer your-api-key" \
107107
-d '{

docs/content/02.user-guide/4.configuration-example.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ navigation:
1616
server:
1717
host: "127.0.0.1"
1818
port: 8999
19-
api_key: "proxy_cast"
19+
api_key: "your-api-key"
2020

2121
# TLS/HTTPS 配置
2222
tls:
2323
enable: false
2424
cert_path: "/path/to/cert.pem"
2525
key_path: "/path/to/key.pem"
2626

27+
# 注意:当前版本暂不支持 TLS。启用后服务将无法启动,请使用反向代理做 TLS 终止。
28+
2729
# 全局代理 URL(支持 socks5/http/https)
2830
proxy_url: "socks5://127.0.0.1:1080"
2931

@@ -278,7 +280,7 @@ injection:
278280
server:
279281
host: "127.0.0.1"
280282
port: 8999
281-
api_key: "proxy_cast"
283+
api_key: "your-api-key"
282284
tls:
283285
enable: false
284286
cert_path: ""

docs/content/02.user-guide/6.config-management.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ resilience:
5656

5757
server:
5858
host: "127.0.0.1"
59-
port: 9090
59+
port: 8999
6060
```
6161
6262
### 敏感信息处理
@@ -107,15 +107,15 @@ server:
107107

108108
```bash
109109
# ProxyCast API Configuration
110-
PROXYCAST_API_BASE=http://127.0.0.1:9090/v1
110+
PROXYCAST_API_BASE=http://127.0.0.1:8999/v1
111111
PROXYCAST_API_KEY=your-api-key
112112
113113
# OpenAI Compatible
114-
OPENAI_API_BASE=http://127.0.0.1:9090/v1
114+
OPENAI_API_BASE=http://127.0.0.1:8999/v1
115115
OPENAI_API_KEY=your-api-key
116116
117117
# Claude Compatible
118-
ANTHROPIC_API_BASE=http://127.0.0.1:9090
118+
ANTHROPIC_API_BASE=http://127.0.0.1:8999
119119
ANTHROPIC_API_KEY=your-api-key
120120
```
121121

@@ -142,6 +142,25 @@ ProxyCast 会自动备份配置:
142142
3. 选择要恢复的版本
143143
4. 点击 **恢复**
144144

145+
## 完整备份与恢复(生产建议)
146+
147+
仅导出配置无法覆盖数据库与凭证文件。生产环境建议定期备份以下路径:
148+
149+
- 配置文件:macOS `~/Library/Application Support/proxycast/config.yaml`;Linux `~/.config/proxycast/config.yaml`;Windows `%APPDATA%\\proxycast\\config.yaml`
150+
- 凭证副本目录:macOS `~/Library/Application Support/proxycast/credentials/`;Linux `~/.local/share/proxycast/credentials/`;Windows `%APPDATA%\\proxycast\\credentials\\`
151+
- 数据库与日志:`~/.proxycast/`(含 `proxycast.db`、`logs/`、`request_logs/`、`auth/`)
152+
153+
```bash
154+
# 示例:备份数据库与日志目录
155+
cp -a ~/.proxycast ~/.proxycast.backup-$(date +%Y%m%d%H%M%S)
156+
```
157+
158+
恢复时将备份内容替换回原路径,并确保应用已退出。
159+
160+
## 旧版本迁移说明
161+
162+
如果检测到旧版 `~/.proxycast/config.json`,当前版本会阻止启动并提示手动迁移。请先导出旧配置或重新导入 YAML 配置,再启动应用。
163+
145164
## 配置同步
146165

147166
### 跨设备同步

0 commit comments

Comments
 (0)