Disabling client auth (clientAuth:false / VITE_DEVTOOLS_DISABLE_CLIENT_AUTH) no longer trusts the client in 0.5
Describe the bug
Disabling client auth no longer marks the client's RPC session as trusted. Whether via the VITE_DEVTOOLS_DISABLE_CLIENT_AUTH=true env var or devtools: { clientAuth: false }, the DevTools client connects and receives the dock list, but __DEVFRAME_HUB_CLIENT_CONTEXT__.rpc.isTrusted stays false and the connection status stays unauthorized. As a result the client keeps showing the authorization prompt and the embedded client never mounts — so headless/e2e environments that relied on this flag to bypass the interactive OTP prompt can no longer drive DevTools.
This is a regression in @vitejs/[email protected] (with [email protected] / @devframes/[email protected]). Downstream, it breaks the Nuxt DevTools e2e suite (every DevTools-dependent test hangs waiting for the client to become trusted).
Root cause
authDisabled is computed and applied only to the transport hub, but the context RPC always registers the interactive-auth handler, so the auto-trust shim is never in effect.
-
createDevToolsContext()unconditionally registers the interactive-auth RPC functions on the context RPC — regardless ofclientAuth/ the env var:// @vitejs/devtools/dist/server-BML20xMb.js:270 const rpcHost = context.rpc; for (const fn of getAuthHandler(context).rpcFunctions) rpcHost.register(fn);getAuthHandleris always the interactive OTP handler (createInteractiveAuth), whoseanonymous:devframe:authonly trusts a session when a valid static/OTP token is presented. -
authDisabledis computed later, increateDevToolsHub(), and is only passed toinitHub({ auth })(the transport shell) — never to the context RPC:// @vitejs/devtools/dist/server-Bf9AYuOm.js:52,60 const authDisabled = context.mode === "build" || context.viteConfig.devtools?.config?.clientAuth === false || process.env.VITE_DEVTOOLS_DISABLE_CLIENT_AUTH === "true"; // ... auth: authDisabled ? false : getAuthHandler(context), -
devframe's
auth: falseauto-trust shim only registers whenanonymous:devframe:authis not already defined — but step 1 already registered it, so the shim is skipped:// devframe/dist/rpc-core-*.mjs:52 if (options.auth === false && !rpcHost.definitions.has("anonymous:devframe:auth")) rpcHost.register({ name: "anonymous:devframe:auth", handler: () => { /* mark session trusted */ return { isTrusted: true } } });
Net effect: disabling auth removes the transport/OTP gate, but the context RPC still has the interactive-auth handler and never marks the session trusted, so isTrusted stays false and the client UI never mounts.
Reproduction
-
Any Vite app using
@vitejs/[email protected]. -
Start the dev server with
VITE_DEVTOOLS_DISABLE_CLIENT_AUTH=true(or setdevtools: { clientAuth: false }). -
In the app page console:
const ctx = window.__DEVFRAME_HUB_CLIENT_CONTEXT__ ctx.connection.status // 'unauthorized' ctx.rpc.isTrusted // false await ctx.rpc.requestTrust() // false (hits the interactive gate; no valid token)
The DevTools UI shows the authorization prompt instead of mounting, despite auth being "disabled".
Expected: with auth disabled, the client session should be trusted automatically (isTrusted === true, status connected) and the UI should mount without a prompt.
Suggested fix
When auth is disabled, either:
- have
createDevToolsContext()skip registering the interactive-auth handler (so devframe'sauth: falseauto-trust shim can register and trust sessions), or - mark incoming sessions
isTrustedat connect time whenauthDisabled, or - surface the auth-disabled state in the connection meta so the client auto-trusts.
The decision that today only feeds initHub's transport auth needs to also reach the context RPC's trust gate.
System Info
@vitejs/devtools: 0.5.0@vitejs/devtools-kit: 0.5.0devframe: 0.9.2@devframes/hub: 0.9.2- Vite: 8.x
- Observed via Nuxt DevTools v4 (embeds
@vitejs/devtools) e2e suite.