-
Notifications
You must be signed in to change notification settings - Fork 450
bug(gateway): dangerouslyDisableDeviceAuth nullifies device identity instead of bypassing pairing check #733
Description
Context
This bug was discovered by a NemoClaw user (NVIDIA/NemoClaw#563) and surfaced during post-merge cleanup of NVIDIA/NemoClaw#1217, which hardened gateway auth defaults in the NemoClaw Dockerfile. We believe the root cause is in OpenShell's gateway resolveControlUiAuthPolicy implementation rather than in NemoClaw.
Description
Setting gateway.controlUi.dangerouslyDisableDeviceAuth: true in openclaw.json is intended to bypass device-pairing authentication (for development, headless, or reverse-proxy setups). Instead, it nullifies the device identity, causing the gateway to reject the connection with code=1008 reason=device identity required.
This creates a catch-22:
dangerouslyDisableDeviceAuth: true→deviceset tonull→hasDeviceIdentityisfalse→ rejected with "device identity required"dangerouslyDisableDeviceAuth: false→ device identity preserved but pairing enforced → pairing required (andopenclaw devices approvemay fail)
Root Cause (as identified by reporter)
In gateway-cli-BjsM6fWb.js, the resolveControlUiAuthPolicy function:
function resolveControlUiAuthPolicy(params) {
const allowInsecureAuthConfigured = params.isControlUi && params.controlUiConfig?.allowInsecureAuth === true;
const dangerouslyDisableDeviceAuth = params.isControlUi && params.controlUiConfig?.dangerouslyDisableDeviceAuth === true;
return {
allowInsecureAuthConfigured,
dangerouslyDisableDeviceAuth,
allowBypass: dangerouslyDisableDeviceAuth,
device: dangerouslyDisableDeviceAuth ? null : params.deviceRaw // ← BUG
};
}When dangerouslyDisableDeviceAuth is true, device is set to null. Downstream, evaluateMissingDeviceIdentity() sees no device identity and rejects. The flag sets allowBypass: true but then removes the device identity that would allow the bypass to work.
Expected Fix
The device field should preserve params.deviceRaw regardless of the dangerouslyDisableDeviceAuth flag:
device: params.deviceRawThis would preserve the device identity while still allowing allowBypass to skip the pairing check — which appears to be the intended behavior of the flag.
NemoClaw Mitigation
NemoClaw PR #1217 mitigated this by defaulting dangerouslyDisableDeviceAuth to false (secure by default) and making it a build-time-only setting. Most users will no longer encounter this. However, anyone who opts in with --build-arg NEMOCLAW_DISABLE_DEVICE_AUTH=1 (for headless/development use) will still hit this bug.
Reproduction Steps
- Set
gateway.controlUi.dangerouslyDisableDeviceAuth: trueinopenclaw.json - Set
gateway.controlUi.allowInsecureAuth: true - Configure a reverse proxy (e.g., Caddy) to proxy to
127.0.0.1:18789 - Open the proxied URL in a browser
- Expected: Browser connects, device auth is bypassed, token login screen appears
- Actual: Gateway rejects with
code=1008 reason=device identity required
Environment (from original reporter)
- OpenClaw 2026.3.11 (29dc654)
- OpenShell v0.0.12
- Ubuntu 24.04 on Hostinger VPS
- Caddy v2.11.2 as reverse proxy
Question
Can you confirm this is an OpenShell gateway fix? We want to make sure we're filing in the right place. Feel free to reach out to me (@jyaunches) with any questions.