tao-shen Claude Opus 4.6 commited on
Commit
483945f
·
1 Parent(s): cad8196

remove: drop gateway password/token auth entirely — device auth only

Browse files

Access is now controlled purely by device pairing. Only browsers
paired via the owner's HuggingFace profile page can connect.
Removed OPENCLAW_PASSWORD from config, sync_hf.py, and README.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (3) hide show
  1. README.md +3 -6
  2. openclaw.json +0 -1
  3. scripts/sync_hf.py +4 -11
README.md CHANGED
@@ -78,7 +78,6 @@ Go to **Settings → Repository secrets** and configure:
78
 
79
  | Secret | Status | Description | Example |
80
  |--------|:------:|-------------|---------|
81
- | `OPENCLAW_PASSWORD` | Recommended | Password for the Control UI (default: `huggingclaw`) | `my-secret-password` |
82
  | `HF_TOKEN` | **Required** | HF Access Token with write permission ([create one](https://huggingface.co/settings/tokens)) | `hf_AbCdEfGhIjKlMnOpQrStUvWxYz` |
83
  | `OPENCLAW_DATASET_REPO` | See below | Dataset repo for backup — format: `username/repo-name`. Required in manual mode; optional in auto mode (see [Data Persistence](#data-persistence)) | `tao-shen/HuggingClaw-data` |
84
  | `OPENAI_API_KEY` | Recommended | OpenAI (or any [OpenAI-compatible](https://openclawdoc.com/docs/reference/environment-variables)) API key | `sk-proj-xxxxxxxxxxxx` |
@@ -124,7 +123,7 @@ Fine-tune persistence and performance. Set these as **Repository Secrets** in HF
124
 
125
  ### 3. Open the Control UI
126
 
127
- Visit your Space URL. Click the settings icon, enter your password, and connect.
128
 
129
  Messaging integrations (Telegram, WhatsApp) can be configured directly inside the Control UI after connecting.
130
 
@@ -141,16 +140,14 @@ HuggingClaw supports **all OpenClaw environment variables** — it passes the en
141
  - **Ollama** — `OLLAMA_HOST`, `OLLAMA_NUM_PARALLEL`, `OLLAMA_KEEP_ALIVE`
142
  - **Secrets** — `OPENCLAW_SECRETS_BACKEND`, `VAULT_ADDR`, `VAULT_TOKEN`
143
 
144
- HuggingClaw adds its own variables for persistence and deployment: `HF_TOKEN`, `OPENCLAW_DATASET_REPO`, `AUTO_CREATE_DATASET`, `SYNC_INTERVAL`, `OPENCLAW_PASSWORD`, `OPENCLAW_DEFAULT_MODEL`, etc. See [`.env.example`](.env.example) for the complete reference.
145
 
146
  ## Security
147
 
148
- - **Password-protected** — the Control UI requires a password to connect and manage the instance
149
  - **Secrets stay server-side** — API keys and tokens are never exposed to the browser
150
  - **Private backups** — the Dataset repo is created as private by default
151
 
152
- > **Tip:** Change the default password from `huggingclaw` to something unique by setting the `OPENCLAW_PASSWORD` secret.
153
-
154
  ## License
155
 
156
  MIT
 
78
 
79
  | Secret | Status | Description | Example |
80
  |--------|:------:|-------------|---------|
 
81
  | `HF_TOKEN` | **Required** | HF Access Token with write permission ([create one](https://huggingface.co/settings/tokens)) | `hf_AbCdEfGhIjKlMnOpQrStUvWxYz` |
82
  | `OPENCLAW_DATASET_REPO` | See below | Dataset repo for backup — format: `username/repo-name`. Required in manual mode; optional in auto mode (see [Data Persistence](#data-persistence)) | `tao-shen/HuggingClaw-data` |
83
  | `OPENAI_API_KEY` | Recommended | OpenAI (or any [OpenAI-compatible](https://openclawdoc.com/docs/reference/environment-variables)) API key | `sk-proj-xxxxxxxxxxxx` |
 
123
 
124
  ### 3. Open the Control UI
125
 
126
+ Visit your Space URL. The Control UI uses device-based authentication — only browsers paired through your HuggingFace profile can connect.
127
 
128
  Messaging integrations (Telegram, WhatsApp) can be configured directly inside the Control UI after connecting.
129
 
 
140
  - **Ollama** — `OLLAMA_HOST`, `OLLAMA_NUM_PARALLEL`, `OLLAMA_KEEP_ALIVE`
141
  - **Secrets** — `OPENCLAW_SECRETS_BACKEND`, `VAULT_ADDR`, `VAULT_TOKEN`
142
 
143
+ HuggingClaw adds its own variables for persistence and deployment: `HF_TOKEN`, `OPENCLAW_DATASET_REPO`, `AUTO_CREATE_DATASET`, `SYNC_INTERVAL`, `OPENCLAW_DEFAULT_MODEL`, etc. See [`.env.example`](.env.example) for the complete reference.
144
 
145
  ## Security
146
 
147
+ - **Device authentication** — only browsers paired through your HuggingFace profile can access the Control UI; incognito or third-party browsers are denied
148
  - **Secrets stay server-side** — API keys and tokens are never exposed to the browser
149
  - **Private backups** — the Dataset repo is created as private by default
150
 
 
 
151
  ## License
152
 
153
  MIT
openclaw.json CHANGED
@@ -3,7 +3,6 @@
3
  "mode": "local",
4
  "bind": "lan",
5
  "port": 7860,
6
- "auth": { "token": "__OPENCLAW_PASSWORD__" },
7
  "trustedProxies": [
8
  "0.0.0.0/0"
9
  ],
 
3
  "mode": "local",
4
  "bind": "lan",
5
  "port": 7860,
 
6
  "trustedProxies": [
7
  "0.0.0.0/0"
8
  ],
scripts/sync_hf.py CHANGED
@@ -65,8 +65,6 @@ OPENAI_BASE_URL = os.environ.get("OPENAI_BASE_URL", "https://api.openai.com/v1")
65
  # OpenRouter API key (optional; alternative to OPENAI_API_KEY + OPENAI_BASE_URL)
66
  OPENROUTER_API_KEY = os.environ.get("OPENROUTER_API_KEY", "")
67
 
68
- # Gateway password (override via HF Secret OPENCLAW_PASSWORD)
69
- OPENCLAW_PASSWORD = os.environ.get("OPENCLAW_PASSWORD", "huggingclaw")
70
 
71
  # Default model for new conversations (infer from provider if not set)
72
  OPENCLAW_DEFAULT_MODEL = os.environ.get("OPENCLAW_DEFAULT_MODEL") or (
@@ -344,10 +342,9 @@ class OpenClawFullSync:
344
  try:
345
  with open(config_path, "r") as f:
346
  cfg = json.load(f)
347
- # Replace token placeholder
348
- if "gateway" in cfg and "auth" in cfg["gateway"]:
349
- if cfg["gateway"]["auth"].get("token") == "__OPENCLAW_PASSWORD__":
350
- cfg["gateway"]["auth"]["token"] = OPENCLAW_PASSWORD
351
  if OPENAI_API_KEY and "models" in cfg and "providers" in cfg["models"] and "openai" in cfg["models"]["providers"]:
352
  cfg["models"]["providers"]["openai"]["apiKey"] = OPENAI_API_KEY
353
  if OPENAI_BASE_URL:
@@ -418,9 +415,6 @@ class OpenClawFullSync:
418
  data["plugins"]["locations"] = [l for l in locs if l != "/dev/null"]
419
 
420
  # Force full gateway config for HF Spaces
421
- if not OPENCLAW_PASSWORD:
422
- print("[SYNC] WARNING: OPENCLAW_PASSWORD not set! Gateway will have no auth.")
423
- auth = {"token": OPENCLAW_PASSWORD} if OPENCLAW_PASSWORD else {}
424
  # Dynamic allowedOrigins from SPACE_HOST (auto-set by HF runtime)
425
  allowed_origins = [
426
  "https://huggingface.co",
@@ -433,14 +427,13 @@ class OpenClawFullSync:
433
  "mode": "local",
434
  "bind": "lan",
435
  "port": 7860,
436
- "auth": auth,
437
  "trustedProxies": ["0.0.0.0/0"],
438
  "controlUi": {
439
  "allowInsecureAuth": True,
440
  "allowedOrigins": allowed_origins
441
  }
442
  }
443
- print(f"[SYNC] Set gateway config (auth={'token' if OPENCLAW_PASSWORD else 'none'}, origins={len(allowed_origins)})")
444
 
445
  # Ensure agents defaults
446
  data.setdefault("agents", {}).setdefault("defaults", {}).setdefault("model", {})
 
65
  # OpenRouter API key (optional; alternative to OPENAI_API_KEY + OPENAI_BASE_URL)
66
  OPENROUTER_API_KEY = os.environ.get("OPENROUTER_API_KEY", "")
67
 
 
 
68
 
69
  # Default model for new conversations (infer from provider if not set)
70
  OPENCLAW_DEFAULT_MODEL = os.environ.get("OPENCLAW_DEFAULT_MODEL") or (
 
342
  try:
343
  with open(config_path, "r") as f:
344
  cfg = json.load(f)
345
+ # Remove auth block (no password/token — device auth only)
346
+ if "gateway" in cfg:
347
+ cfg["gateway"].pop("auth", None)
 
348
  if OPENAI_API_KEY and "models" in cfg and "providers" in cfg["models"] and "openai" in cfg["models"]["providers"]:
349
  cfg["models"]["providers"]["openai"]["apiKey"] = OPENAI_API_KEY
350
  if OPENAI_BASE_URL:
 
415
  data["plugins"]["locations"] = [l for l in locs if l != "/dev/null"]
416
 
417
  # Force full gateway config for HF Spaces
 
 
 
418
  # Dynamic allowedOrigins from SPACE_HOST (auto-set by HF runtime)
419
  allowed_origins = [
420
  "https://huggingface.co",
 
427
  "mode": "local",
428
  "bind": "lan",
429
  "port": 7860,
 
430
  "trustedProxies": ["0.0.0.0/0"],
431
  "controlUi": {
432
  "allowInsecureAuth": True,
433
  "allowedOrigins": allowed_origins
434
  }
435
  }
436
+ print(f"[SYNC] Set gateway config (auth=device-only, origins={len(allowed_origins)})")
437
 
438
  # Ensure agents defaults
439
  data.setdefault("agents", {}).setdefault("defaults", {}).setdefault("model", {})