Harden gateway auth: avoid undefined/null tokens from configure
Solves a real misconfiguration trap where gateway.auth.token becomes a guessable literal string. Use sanitized input + reconfigure flow to force random token fallback.
GITHUBDiscovered 2026-02-14Author omair445
Prerequisites
- OpenClaw CLI access on the host (can run configure and gateway commands).
- Permission to restart gateway after config change.
Steps
- Inspect current auth config and verify token is not empty/placeholder text.
- Run interactive configure again and explicitly set a real token or leave blank for auto-generated random token.
- Restart gateway and immediately test one authenticated request path.
- If deployment uses scripts/templates, add validation to reject literal undefined/null before writing config.
Commands
openclaw configure --section gatewayopenclaw gateway restartopenclaw gateway statusVerify
Gateway status is healthy and config no longer contains literal undefined/null auth values.
Caveats
- Rotating token may invalidate existing clients; plan a short maintenance window.
- Scripted deployments with env interpolation can still reintroduce bad strings if input validation is missing(需验证).
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗