Skip to content

Commit b667fe4

Browse files
committed
feat: broaden Claude allowlist defaults
1 parent 2a30bb8 commit b667fe4

7 files changed

Lines changed: 33 additions & 2 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,19 @@ cp deploy/vps.example.yaml deploy/vps.yaml
5151

5252
示例已经包含常见模型服务域名:
5353

54+
- `.claude.ai`
55+
- `.claude.com`
5456
- `.anthropic.com`
5557
- `.openai.com`
5658
- `.openrouter.ai`
5759
- `.chatgpt.com`
5860

61+
默认示例还会通过 `runtime.dest_host_allowlist` 放行精确主机 `storage.googleapis.com`,用于兼容 Claude Code 仍在迁移中的 legacy 下载路径。
62+
63+
不建议直接把白名单放空或改成近似全放开。更稳的做法是按产品域族放行,比如 Claude 用 `.anthropic.com``.claude.com``.claude.ai`,再补必要的精确 host。
64+
65+
如果 `Claude Code` 提示无法连接 `platform.claude.com`,说明你当前部署的白名单里还没有放行 `.claude.com`。把它加入 `runtime.dest_suffix_allowlist` 后重新执行部署。
66+
5967
执行部署:
6068

6169
```bash

README_EN.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,19 @@ Start with:
5555

5656
The sample already includes common model service domains:
5757

58+
- `.claude.ai`
59+
- `.claude.com`
5860
- `.anthropic.com`
5961
- `.openai.com`
6062
- `.openrouter.ai`
6163
- `.chatgpt.com`
6264

65+
The default sample also allowlists the exact host `storage.googleapis.com` through `runtime.dest_host_allowlist` to cover Claude Code's legacy download path while that migration is still in progress.
66+
67+
Avoid removing the allowlist entirely or approximating a wildcard. A better default is to allow vendor product domain families such as `.anthropic.com`, `.claude.com`, and `.claude.ai`, then add a small number of exact hosts only when needed.
68+
69+
If Claude Code cannot connect to `platform.claude.com`, your current allowlist is missing `.claude.com`. Add it to `runtime.dest_suffix_allowlist` and rerun the deployment.
70+
6371
Run the deploy:
6472

6573
```bash

SEND_THIS_TO_LLM.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,14 @@
3939
- 代理监听 `127.0.0.1:8080`
4040
- 管理端监听 `127.0.0.1:9090`
4141
- 默认放行:
42+
- `.claude.ai`
43+
- `.claude.com`
4244
- `.anthropic.com`
4345
- `.openai.com`
4446
- `.openrouter.ai`
4547
- `.chatgpt.com`
48+
- 默认精确 host 放行:
49+
- `storage.googleapis.com`
4650
- 客户端通过 SSH 隧道访问服务端
4751

4852
## 部署方式

deploy/vps.example.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ runtime:
2121
- ::1/128
2222
dest_port_allowlist:
2323
- 443
24+
dest_host_allowlist:
25+
- storage.googleapis.com
2426
dest_suffix_allowlist:
27+
- .claude.ai
28+
- .claude.com
2529
- .anthropic.com
2630
- .openai.com
2731
- .openrouter.ai

internal/deploy/deploy_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ func TestRenderVPSEnvUsesAbsoluteRuntimePaths(t *testing.T) {
2323
AdminListenPort: 9090,
2424
SourceAllowlistCIDRs: []string{"127.0.0.1/32"},
2525
DestPortAllowlist: []int{443},
26+
DestHostAllowlist: []string{"storage.googleapis.com"},
2627
DestSuffixAllowlist: []string{".chatgpt.com"},
2728
MaxConnsPerIP: 16,
2829
ServerReadHeaderTimeout: "10s",
@@ -48,6 +49,9 @@ func TestRenderVPSEnvUsesAbsoluteRuntimePaths(t *testing.T) {
4849
if !strings.Contains(text, "DEST_SUFFIX_ALLOWLIST=.chatgpt.com") {
4950
t.Fatalf("env missing suffix allowlist: %s", text)
5051
}
52+
if !strings.Contains(text, "DEST_HOST_ALLOWLIST=storage.googleapis.com") {
53+
t.Fatalf("env missing host allowlist: %s", text)
54+
}
5155
}
5256

5357
func TestRenderVPSUsersHashesPlaintextPasswords(t *testing.T) {

internal/deploy/spec.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,11 @@ func normalizeVPSConfig(spec VPSConfig) (VPSConfig, error) {
178178
if len(runtime.DestPortAllowlist) == 0 {
179179
runtime.DestPortAllowlist = []int{443}
180180
}
181+
if len(runtime.DestHostAllowlist) == 0 {
182+
runtime.DestHostAllowlist = []string{"storage.googleapis.com"}
183+
}
181184
if len(runtime.DestSuffixAllowlist) == 0 {
182-
runtime.DestSuffixAllowlist = []string{".anthropic.com", ".openai.com", ".openrouter.ai", ".chatgpt.com"}
185+
runtime.DestSuffixAllowlist = []string{".claude.ai", ".claude.com", ".anthropic.com", ".openai.com", ".openrouter.ai", ".chatgpt.com"}
183186
}
184187
if runtime.MaxConnsPerIP == 0 {
185188
runtime.MaxConnsPerIP = 16

plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Recommended default in v1:
5151
This service must not become a generic open proxy. P0 should enforce:
5252
- Destination port allowlist, default `443`
5353
- Destination hostname exact match allowlist
54-
- Destination suffix allowlist, for example `.anthropic.com`, `.openai.com`
54+
- Destination suffix allowlist, for example `.claude.ai`, `.claude.com`, `.anthropic.com`, `.openai.com`
5555
- Resolution-time IP blocking for private/reserved IPs
5656

5757
Optional future expansion:

0 commit comments

Comments
 (0)