fix(security): prevent gateway token from defaulting to 'undefined' string

This commit is contained in:
Hisleren
2026-01-30 23:06:07 +03:00
committed by Gustavo Madeira Santana
parent 0175cedf0e
commit 201d7fa956
2 changed files with 5 additions and 2 deletions

View File

@@ -177,7 +177,8 @@ export async function promptGatewayConfig(
}),
runtime,
);
gatewayToken = String(tokenInput).trim() || randomToken();
const rawInput = tokenInput ? String(tokenInput).trim() : "";
gatewayToken = rawInput || randomToken();
}
if (authMode === "password") {

View File

@@ -182,7 +182,9 @@ export async function configureGatewayForOnboarding(
placeholder: "Needed for multi-machine or non-loopback access",
initialValue: quickstartGateway.token ?? "",
});
gatewayToken = String(tokenInput).trim() || randomToken();
// FIX: Ensure undefined becomes an empty string, not "undefined" string
const rawInput = tokenInput ? String(tokenInput).trim() : "";
gatewayToken = rawInput || randomToken();
}
}