Skip to content

Security: wu840407/openclaw-agents

Security

SECURITY.md

安全注意事項

一、絕不能進 git 的東西

類型 範例位置 為什麼
LLM API key openclaw.jsonproviders.*.apiKey 別人燒你的 quota / 看你的對話
Telegram bot token openclaw.jsonchannels.telegram.accounts.*.botToken 別人可以冒用 bot 對你發訊息
Telegram chat_id allowFrom credentials/telegram-*-allowFrom.json 揭露你的 Telegram 帳號 ID
交易所 API key + secret credentials/binance-*.json 真金白銀,最嚴重
Gateway token openclaw.jsongateway.auth.token OpenClaw 內部認證主鑰
USER.md 各 agent workspace 通常含真名、住址、資產組合
memory/MEMORY.md 各 agent workspace 累積的對話與決策歷史

這些都已經放進 .gitignore,但最後一道防線是你自己

# 每次 push 前手動掃一次
git diff --staged | grep -iE 'token|api[-_]?key|secret|chat_id|password|botToken'

二、本範本的占位符約定

  • <TELEGRAM_BOT_TOKEN> — Telegram bot token,向 @BotFather 申請
  • <TELEGRAM_CHAT_ID> — 你的 Telegram numeric user ID(給機器人發訊息的對象)
  • <OPENROUTER_API_KEY> — OpenRouter / LLM provider 金鑰
  • <BINANCE_API_KEY> / <BINANCE_SECRET> — Binance 期貨 API
  • <GATEWAY_TOKEN> — 自己設定的強密碼字串
  • <USER> — Linux 使用者名(檔案路徑用)

三、Binance API 設定最佳實務

如果你部署 crypto-trader-miku務必在 Binance 後台:

  1. 建立 API key 時勾選 IP 白名單,只允許你的部署機器 IP
  2. 取消勾選「提幣」權限,只開啟「合約交易」
  3. 先用 testnet key 跑滿 4 週,回測 Sharpe ≥ 1.0 再上實盤
  4. 實盤金額先小(範本預設 100 USDT 試水盤)
  5. 設定 kill switch:Telegram 收到關機指令立即市價清倉

四、Telegram bot 設定最佳實務

  1. BotFather 申請新 bot,不要重用用過的舊 bot
  2. 開啟 dmPolicy: pairing(OpenClaw 預設)— bot 只回應已配對的 chat_id
  3. groupPolicy: allowlist — bot 不亂回應未授權群組
  4. 將你的 numeric user ID 加入 credentials/telegram-*-allowFrom.json
  5. 不要把 bot 加入公開群組

五、如果你不小心 commit 了金鑰

立即執行:

# 1. 在對應服務的後台「撤銷」這把金鑰(OpenRouter / Binance / Telegram BotFather)
# 2. 重新申請新金鑰,更新本機 credentials/,不要 commit
# 3. 把 git 歷史中的洩漏抹除
git filter-repo --invert-paths --path credentials/binance-live.json
# 或用 BFG Repo-Cleaner
bfg --replace-text passwords.txt
git push --force-with-lease

⚠️ 撤銷舊金鑰是第一步。光把檔案從 git 移除不夠 — 歷史 commit 仍然存在於別人 clone 的副本。

六、Gateway token 不要用個資

OpenClaw 的 gateway.auth.token 是內部認證的主鑰。不要用:

  • 姓名 + 生日(例如 john19951225
  • 寵物名 + 簡單數字
  • 任何「容易被社交工程猜中」的字串

請用:

openssl rand -hex 32   # 64 字元的安全 token

七、受管制領域提醒

daily-news-briefing-lay 是通用的新聞情報彙整範本。如果你要把它客製化為特定受管制領域(國防、情報、金融監理、醫療、法律等)的版本,請先確認:

  • 你所在地法律允許這類資訊蒐集與彙整
  • 你引用的來源遵守該來源的 robots.txt 與 ToS
  • 你不會把彙整結果用於違法用途(誹謗、選舉操作、市場操縱等)

範本本身不對任何特定領域做價值判斷,使用者自負客製化後的法律責任。

There aren't any published security advisories