Skip to content

Commit 1fc0e74

Browse files
committed
fix: make origin enforcement opt-in
Disable Origin and Referer enforcement by default for the same-compose setup while keeping ADMIN_ALLOWED_ORIGINS available for stricter deployments.
1 parent 12b2fde commit 1fc0e74

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

.env.example

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,10 @@ ADMIN_SESSION_TTL_DAYS=30
3030
ADMIN_SESSION_COOKIE_NAME=cliproxy_admin_session
3131
ADMIN_SESSION_SECURE_COOKIE=false
3232
ADMIN_SESSION_SAMESITE=Lax
33-
# Optional comma-separated allowlist. Leave empty to allow same-origin host automatically.
33+
# Optional comma-separated allowlist for stricter Origin/Referer checks on auth/admin POST routes.
34+
# Leave empty to disable Origin enforcement (recommended for the default same-compose setup).
3435
ADMIN_ALLOWED_ORIGINS=
3536

3637
# Frontend polling interval (seconds)
3738
VITE_AUTO_REFRESH_SECONDS=60
3839
VITE_APP_LOGS_PAGE_SIZE=500
39-
40-
# Optional: Lark MCP local setup (for Claude Code .mcp.json)
41-
LARK_APP_ID=cli_xxx
42-
LARK_APP_SECRET=your-lark-app-secret
43-
LARK_DOMAIN=https://open.larksuite.com
44-
LARK_TOOLSETS=preset.base,preset.task,task.v2.task.get,task.v2.task.list,task.v2.tasklist.list,task.v2.tasklist.tasks

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Notes:
8686
- The browser stores only an `HttpOnly` session cookie; the password is never stored in browser storage.
8787
- If you deploy behind HTTPS, set `ADMIN_SESSION_SECURE_COOKIE=true`.
8888
- Default host port for PostgREST is now `8418` to avoid common conflicts on `3000`. Override with `POSTGREST_HOST_PORT` if needed.
89+
- `ADMIN_ALLOWED_ORIGINS` is optional. Leave it empty for the default same-compose setup; set it only if you want stricter Origin/Referer enforcement.
8990

9091
### 5) Start services
9192
```bash

collector/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ def _origin_allowed(origin: str) -> bool:
204204

205205

206206
def _validate_same_origin_request() -> Optional[Response]:
207+
if not ADMIN_ALLOWED_ORIGINS:
208+
return None
209+
207210
origin = _get_request_origin()
208211
referer = (request.headers.get('Referer') or '').strip()
209212

0 commit comments

Comments
 (0)