Remove IP whitelist mechanism, keep only token authentication

Co-authored-by: krau <71133316+krau@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-19 05:42:14 +00:00
parent 20a5e317ae
commit 173a5e3733
6 changed files with 11 additions and 204 deletions

View File

@@ -21,8 +21,6 @@ port = 8080
token = "your-secret-token-here"
# Task completion callback webhook URL (leave empty to disable)
webhook_url = "https://your-server.com/webhook"
# Trusted IP addresses (leave empty to allow all), supports single IP or CIDR notation
trusted_ips = ["127.0.0.1", "192.168.1.0/24"]
```
## Authentication
@@ -33,8 +31,6 @@ If `token` is configured, all API requests (except `/health`) must include an `A
Authorization: Bearer your-secret-token-here
```
If `trusted_ips` is configured, requests will only be accepted from specified IP addresses.
## Endpoints
### Health Check
@@ -256,7 +252,6 @@ print(f"Task status: {status['status']}")
## Security Recommendations
1. **Always use a strong token** for production environments
2. **Enable IP whitelist** (`trusted_ips`) to restrict access
3. **Use HTTPS** in production by placing the API behind a reverse proxy (e.g., Nginx, Caddy)
4. **Keep logs secure** as they may contain sensitive information
5. **Validate user permissions** - ensure `user_id` in requests corresponds to authorized users in your config
2. **Use HTTPS** in production by placing the API behind a reverse proxy (e.g., Nginx, Caddy)
3. **Keep logs secure** as they may contain sensitive information
4. **Validate user permissions** - ensure `user_id` in requests corresponds to authorized users in your config

View File

@@ -21,8 +21,6 @@ port = 8080
token = "your-secret-token-here"
# 任务完成回调 Webhook URL (留空则不回调)
webhook_url = "https://your-server.com/webhook"
# 可信任的 IP 地址列表 (留空则不限制), 支持单个 IP 或 CIDR 格式
trusted_ips = ["127.0.0.1", "192.168.1.0/24"]
```
## 认证
@@ -33,8 +31,6 @@ trusted_ips = ["127.0.0.1", "192.168.1.0/24"]
Authorization: Bearer your-secret-token-here
```
如果配置了 `trusted_ips`,请求只会从指定的 IP 地址被接受。
## 端点
### 健康检查
@@ -256,7 +252,6 @@ print(f"任务状态: {status['status']}")
## 安全建议
1. **生产环境始终使用强令牌**
2. **启用 IP 白名单** (`trusted_ips`) 限制访问
3. **生产环境使用 HTTPS**,通过反向代理(如 Nginx、Caddy放置 API
4. **保护日志安全**,因为它们可能包含敏感信息
5. **验证用户权限** - 确保请求中的 `user_id` 对应于配置中的授权用户
2. **生产环境使用 HTTPS**,通过反向代理(如 Nginx、Caddy放置 API
3. **保护日志安全**,因为它们可能包含敏感信息
4. **验证用户权限** - 确保请求中的 `user_id` 对应于配置中的授权用户