返回顶部
t

token-safety-checker

Scan openclaw.json for plaintext secrets (tokens, API keys, passwords) and migrate them to environment variables using SecretRef. Use when the user asks to "check token safety", "privatize secrets", "move tokens to env vars", "audit openclaw config for secrets", or after any openclaw.json edit that may have introduced plaintext credentials. Also use when setting up a new OpenClaw instance for the first time.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 2.0.0
安全检测
已通过
135
下载量
0
收藏
概述
安装方式
版本历史

token-safety-checker

# Token Safety Checker Scan `openclaw.json` for plaintext secrets and migrate them to environment variables via SecretRef. All operations run locally. Secret values are never passed as CLI arguments, never logged, and never appear in agent context. ## Script Single entry point: `scripts/safeclaw.py` ``` python3 safeclaw.py scan [--config PATH] python3 safeclaw.py migrate [--findings JSON] [--config PATH] [--profile PATH] [--dry-run] [--restore] ``` ## How secrets are protected | Risk | Mitigation | |------|-----------| | Secret values in `scan` output | `scan` returns **paths + lengths only** — never values | | Secret values in CLI args | `migrate` reads values from disk internally — never via `--values` arg | | Secret values in dry-run output | Masked as `export VAR="***"` | | Secret values in agent context | `findings` JSON only contains `path`, `env_var`, `length` — safe to pass through SKILL | | Secret values in logs | No logging of values at any point | ## Workflow ### 1. Scan ```bash python3 <skill_dir>/scripts/safeclaw.py scan [--config ~/.openclaw/openclaw.json] ``` Output (safe to use in agent context — no secret values): ```json { "findings": [ { "path": "channels.discord.token", "env_var": "OPENCLAW_DISCORD_TOKEN", "length": 72 } ], "shell": { "name": "zsh", "profile": "~/.zshrc", "source_cmd": "source ~/.zshrc" } } ``` Exit 0 = clean → report and stop. Exit 1 = findings → continue. Exit 2 = config not found. ### 2. Show findings to user and confirm Present the findings table (`path | env_var | length`). Allow renaming env vars. **Do not proceed without explicit confirmation.** ### 3. Dry-run ```bash python3 <skill_dir>/scripts/safeclaw.py migrate \ --findings '<findings JSON from step 1>' \ --dry-run ``` Show output to user. The script re-reads config from disk to verify findings are still current. Confirm before proceeding. ### 4. Migrate ```bash python3 <skill_dir>/scripts/safeclaw.py migrate \ --findings '<findings JSON from step 1>' ``` The script: 1. **Re-scans** config from disk to confirm findings are still plaintext 2. **Backs up** `openclaw.json` → `openclaw.json.bak` 3. **Reads** secret values internally from disk (not from CLI args) 4. **Appends** env exports to shell profile (skips duplicates, masks values in output) 5. **Replaces** plaintext values with SecretRef in `openclaw.json` ### 5. Source profile + restart gateway ⚠️ Check how the gateway is managed: **Shell-launched (most local setups):** ```bash source <profile> openclaw gateway restart ``` **systemd:** Add vars to `EnvironmentFile=` in the unit — sourcing a shell profile won't work. **Docker:** Pass via `-e` or `environment:` in compose. ### 6. Verify ```bash python3 <skill_dir>/scripts/safeclaw.py scan # exit 0 = clean openclaw gateway status ``` ### 7. Rollback ```bash python3 <skill_dir>/scripts/safeclaw.py migrate --restore ``` ## SecretRef format ```json { "source": "env", "provider": "default", "id": "MY_ENV_VAR" } { "source": "file", "provider": "default", "id": "/path/to/secret.txt" } { "source": "exec", "provider": "default", "id": "command --prints --secret" } ``` `env` is recommended for most setups. For higher-security environments, prefer `file` or `exec`.

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 token-safety-checker-1775931522 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 token-safety-checker-1775931522 技能

通过命令行安装

skillhub install token-safety-checker-1775931522

下载 Zip 包

⬇ 下载 token-safety-checker v2.0.0

文件大小: 12.61 KB | 发布时间: 2026-4-12 11:42

v2.0.0 最新 2026-4-12 11:42
Release 2.0.0

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部