5.9 KiB
Runtime Hardening and Startup
This guide explains the startup security model and bridge compatibility behavior.
What this covers
- Runtime profile selection
- Hardened startup enforcement behavior
- Module startup boundaries
- Bridge protocol handshake compatibility
Runtime profile
Use OPENCLAW_RUNTIME_PROFILE to select startup posture:
minimal(default): compatibility-firsthardened: strict fail-closed startup checks
If the value is unknown, startup falls back to minimal with a warning.
You can verify the active profile through:
GET /openclaw/capabilitiesGET /moltbot/capabilities
The response includes runtime_profile.
Hardened startup enforcement
When OPENCLAW_RUNTIME_PROFILE=hardened, startup enforces mandatory controls and aborts on failure.
Current mandatory checks:
- Authentication is configured for privileged actions
- Unsafe egress bypass is not enabled:
OPENCLAW_ALLOW_ANY_PUBLIC_LLM_HOSTmust not bypass policyOPENCLAW_ALLOW_INSECURE_BASE_URLmust not bypass policy
- If webhook module is active, webhook auth mode must be configured
- Redaction service must be available
- Connector ingress allowlist coverage is enforced for strict posture:
OPENCLAW_RUNTIME_PROFILE=hardened: startup fails closed if an active connector platform has no allowlistOPENCLAW_DEPLOYMENT_PROFILE=public: deployment/startup checks fail closed for the same condition (DP-PUBLIC-009)
In minimal mode, these checks are warning-first for local/LAN posture, but public deployment profile still enforces fail-closed policy checks.
Bootstrap fail-closed propagation
Startup bootstrap no longer swallows fatal security-gate errors. If a critical startup gate fails, initialization aborts deterministically instead of continuing with partial route registration.
Startup lifecycle diagnostics
The health response includes a startup diagnostic object with:
state:starting,ready,degraded-warmup, orfatal-startupready: whether required route/service startup completedfatal: bounded fatal-startup details when required startup failswarmups: bounded status for optional background warmups
Required startup work still fails closed. Optional warmups such as model inventory refresh run after route registration and do not block baseline API availability. Their failures or timeouts are reported as degraded-warmup.
Optional warmup timeout can be tuned with:
OPENCLAW_STARTUP_WARMUP_TIMEOUT_SEC- legacy alias:
MOLTBOT_STARTUP_WARMUP_TIMEOUT_SEC
Public deployment shared-surface acknowledgement
When running deployment profile checks for public posture (OPENCLAW_DEPLOYMENT_PROFILE=public),
you must explicitly acknowledge that upstream boundary controls are in place:
OPENCLAW_PUBLIC_SHARED_SURFACE_BOUNDARY_ACK=1
Why this exists:
- OpenClaw shares ComfyUI's listener/port.
- Route auth on
/openclaw/*does not automatically protect ComfyUI-native high-risk routes. - Public posture requires reverse-proxy path allowlist + network ACL boundaries.
Gate behavior:
- missing ack in public profile: deployment profile check fails (
DP-PUBLIC-008) - ack present: this boundary contract check passes
Connector allowlist posture in strict profiles
Connector token/enable markers activate ingress posture checks for:
- Telegram, Discord, LINE, WhatsApp, WeChat, KakaoTalk, Slack, Feishu/Lark
When a platform is active, at least one platform-specific allowlist variable must be configured.
publicdeployment profile: fail-closed (DP-PUBLIC-009)hardenedruntime profile: fail-closed at startup gate- non-strict local/LAN posture: warning posture in Security Doctor (
s32_allowlist_coverage)
Localhost no-origin override posture
OPENCLAW_LOCALHOST_ALLOW_NO_ORIGIN controls a localhost convenience escape hatch for clients
that do not send Origin / Sec-Fetch-Site headers.
- Default/unset: strict behavior remains active (no-origin requests are denied in convenience mode).
- When set to
true: no-origin localhost requests are allowed in convenience mode.
Operational visibility:
- Startup emits an explicit warning when the override is enabled.
- Security Doctor reports this as an explicit posture check (
csrf_no_origin_override, codeSEC-CSRF-001). - Startup audit includes a dedicated event so operators can trace when this override is active.
Security note:
- Keep this override disabled for shared/LAN/public deployments.
- Enable only for local CLI/tooling compatibility, and only as long as required.
Module startup boundaries
Module enablement is decided during startup and then locked.
Current boundary behavior:
- Core, security, observability, scheduler, webhook, and connector modules are initialized at startup
- Bridge module initialization is conditional on
OPENCLAW_BRIDGE_ENABLED - If bridge is disabled, bridge route registration is skipped
Bridge protocol handshake
Sidecar startup performs protocol compatibility negotiation with:
POST /bridge/handshake
Request body:
{ "version": 1 }
Response behavior:
200when compatible409when incompatible (too old or too new)- Includes compatibility metadata such as server version and minimum supported version
The sidecar bridge client executes this handshake during startup before worker polling.
Recommended startup baseline
Use this as a starting point for hardened deployments:
OPENCLAW_RUNTIME_PROFILE=hardened
OPENCLAW_ADMIN_TOKEN=replace-with-strong-token
OPENCLAW_WEBHOOK_AUTH_MODE=hmac
OPENCLAW_WEBHOOK_HMAC_SECRET=replace-with-strong-secret
OPENCLAW_BRIDGE_ENABLED=1
OPENCLAW_BRIDGE_DEVICE_TOKEN=replace-with-bridge-device-token
# Optional: clear stale history in startup log views
OPENCLAW_LOG_TRUNCATE_ON_START=1
Then validate:
- Restart ComfyUI and check startup logs for security gate result.
- Call
GET /openclaw/capabilitiesand confirmruntime_profile. - If sidecar is used, verify handshake succeeds before worker polling begins.