Skip to content

Commit 3e26df9

Browse files
committed
fix(ui): drop the retired-key device-auth reader from the security summary
Review findings on the migration-window removal: the Control UI security summary still derived its "Device auth" row from the retired dangerouslyDisableDeviceAuth key, rendering device auth as disabled on configurations that merely retain the inert key. Device auth is now unconditionally enforced, so the row and its derivation are removed rather than pinned to a constant. The build-admission test also tracks and removes its temporary device-identity databases after each run.
1 parent 9f1e702 commit 3e26df9

6 files changed

Lines changed: 17 additions & 26 deletions

File tree

‎src/gateway/server/ws-connection/message-handler.control-ui-build-admission.test.ts‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ import { attachGatewayWsMessageHandler } from "./message-handler.js";
8585

8686
// A stale Control UI browser still owns a device identity; the build check is
8787
// only reachable once the device passes connect auth and silent local pairing.
88+
const temporaryIdentityPaths: string[] = [];
89+
8890
async function buildSignedControlUiDevice(nonce: string) {
8991
const { buildDeviceAuthPayload } = await import("../../device-auth.js");
9092
const { loadOrCreateDeviceIdentity, publicKeyRawBase64UrlFromPem, signDevicePayload } =
9193
await import("../../../infra/device-identity.js");
92-
const identity = loadOrCreateDeviceIdentity({
93-
path: path.join(tmpdir(), `openclaw-build-admission-${randomUUID()}.sqlite`),
94-
});
94+
const identityPath = path.join(tmpdir(), `openclaw-build-admission-${randomUUID()}.sqlite`);
95+
temporaryIdentityPaths.push(identityPath);
96+
const identity = loadOrCreateDeviceIdentity({ path: identityPath });
9597
const signedAtMs = Date.now();
9698
const payload = buildDeviceAuthPayload({
9799
deviceId: identity.deviceId,
@@ -126,9 +128,19 @@ function withDeadline<T>(promise: Promise<T>, label: string): Promise<T> {
126128
]);
127129
}
128130

129-
afterEach(() => {
131+
afterEach(async () => {
130132
vi.clearAllMocks();
131133
resolveRuntimeServiceBuildIdMock.mockReturnValue("gateway-build");
134+
const { rm } = await import("node:fs/promises");
135+
await Promise.all(
136+
temporaryIdentityPaths
137+
.splice(0)
138+
.flatMap((identityPath) =>
139+
[identityPath, `${identityPath}-wal`, `${identityPath}-shm`].map((file) =>
140+
rm(file, { force: true }),
141+
),
142+
),
143+
);
132144
});
133145

134146
describe("Control UI build admission over WebSocket", () => {

‎ui/src/i18n/locales/en.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,6 @@ export const en: TranslationMap = {
15011501
title: "Security",
15021502
gatewayAuth: "Gateway auth",
15031503
execPolicy: "Exec policy",
1504-
deviceAuth: "Device auth",
15051504
browserEnabled: "Browser enabled",
15061505
toolProfile: "Tool profile",
15071506
},

‎ui/src/pages/config/config-page.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ export function extractQuickSettingsSecurity(config: unknown): SecurityOverview
190190
return {
191191
gatewayAuth: "unknown",
192192
execPolicy: "unknown",
193-
deviceAuth: false,
194193
browserEnabled: true,
195194
browserEnabledOverridden: false,
196195
toolProfile: "full",
@@ -202,7 +201,6 @@ export function extractQuickSettingsSecurity(config: unknown): SecurityOverview
202201
const tools = asConfigRecord(root.tools);
203202
const exec = asConfigRecord(tools?.exec) ?? {};
204203
const browser = asConfigRecord(root.browser);
205-
const controlUi = asConfigRecord(gateway?.controlUi);
206204
let gatewayAuth = "unknown";
207205
if (auth) {
208206
const mode = typeof auth.mode === "string" ? auth.mode.trim() : "";
@@ -221,7 +219,6 @@ export function extractQuickSettingsSecurity(config: unknown): SecurityOverview
221219
return {
222220
gatewayAuth,
223221
execPolicy: typeof security === "string" && security.trim() ? security.trim() : "allowlist",
224-
deviceAuth: controlUi?.dangerouslyDisableDeviceAuth !== true,
225222
browserEnabled: browser?.enabled !== false,
226223
browserEnabledOverridden: browser !== null && Object.hasOwn(browser, "enabled"),
227224
toolProfile: typeof profile === "string" && profile.trim() ? profile.trim() : "full",

‎ui/src/pages/config/security.test.ts‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ function createProps(overrides: Partial<SecurityViewProps> = {}): SecurityViewPr
4646
security: {
4747
gatewayAuth: "token",
4848
execPolicy: "allowlist",
49-
deviceAuth: true,
5049
browserEnabled: true,
5150
browserEnabledOverridden: true,
5251
toolProfile: "coding",
@@ -74,7 +73,6 @@ describe("renderSecurity", () => {
7473
security: {
7574
gatewayAuth: "token",
7675
execPolicy: "allowlist",
77-
deviceAuth: true,
7876
browserEnabled: false,
7977
browserEnabledOverridden: true,
8078
toolProfile: "messaging",
@@ -120,7 +118,7 @@ describe("renderSecurity", () => {
120118
expect(browserRow.querySelector("wa-switch")?.hasAttribute("disabled")).toBe(true);
121119
});
122120

123-
it("shows gateway auth and device auth as dot statuses, not pills", () => {
121+
it("shows gateway auth as a dot status, not a pill", () => {
124122
const container = document.createElement("div");
125123

126124
render(
@@ -129,7 +127,6 @@ describe("renderSecurity", () => {
129127
security: {
130128
gatewayAuth: "none",
131129
execPolicy: "allowlist",
132-
deviceAuth: true,
133130
browserEnabled: true,
134131
browserEnabledOverridden: false,
135132
toolProfile: "full",
@@ -144,8 +141,6 @@ describe("renderSecurity", () => {
144141
const authStatus = authRow.querySelector(".settings-status");
145142
expect(authStatus?.textContent?.trim()).toBe("none");
146143
expect(authStatus?.classList.contains("settings-status--warn")).toBe(true);
147-
const deviceRow = expectRowByTitle(container, "Device auth");
148-
expect(deviceRow.querySelector(".settings-status--ok")?.textContent?.trim()).toBe("Enabled");
149144
});
150145

151146
it("opens mobile pairing from the overview", () => {
@@ -183,7 +178,6 @@ describe("renderSecurity", () => {
183178
security: {
184179
gatewayAuth: "token",
185180
execPolicy: "allowlist",
186-
deviceAuth: true,
187181
browserEnabled: true,
188182
browserEnabledOverridden: false,
189183
toolProfile: "full",
@@ -214,7 +208,6 @@ describe("renderSecurity", () => {
214208
security: {
215209
gatewayAuth: "token",
216210
execPolicy: "allowlist",
217-
deviceAuth: true,
218211
browserEnabled: true,
219212
browserEnabledOverridden: true,
220213
toolProfile: "full",

‎ui/src/pages/config/security.ts‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const SECURITY_DOCS_URL = "https://docs.openclaw.ai/gateway/security";
2121
export type SecurityOverview = {
2222
gatewayAuth: string;
2323
execPolicy: string;
24-
deviceAuth: boolean;
2524
browserEnabled: boolean;
2625
browserEnabledOverridden: boolean;
2726
toolProfile: string;
@@ -45,7 +44,6 @@ function renderSecurityOverview(props: SecurityViewProps) {
4544
const {
4645
gatewayAuth,
4746
execPolicy,
48-
deviceAuth,
4947
browserEnabled,
5048
browserEnabledOverridden,
5149
toolProfile,
@@ -106,13 +104,6 @@ function renderSecurityOverview(props: SecurityViewProps) {
106104
})}
107105
`,
108106
}),
109-
renderSettingsRow({
110-
title: t("quickSettings.security.deviceAuth"),
111-
control: renderSettingsStatus({
112-
kind: deviceAuth ? "ok" : "warn",
113-
label: deviceAuth ? t("common.enabled") : t("common.disabled"),
114-
}),
115-
}),
116107
renderSettingsRow({
117108
title: t("devices.pairing.title"),
118109
control: html`

‎ui/src/pages/config/settings-targets.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export const SETTINGS_SEARCH_TARGETS = {
5454
searchKeys: [
5555
"quickSettings.security.gatewayAuth",
5656
"quickSettings.security.execPolicy",
57-
"quickSettings.security.deviceAuth",
5857
"quickSettings.security.browserEnabled",
5958
"quickSettings.security.toolProfile",
6059
],

0 commit comments

Comments
 (0)