From d40a5ab6dab886b910db16a9375ddd2b56736483 Mon Sep 17 00:00:00 2001 From: "buf0-bot[bot]" <252831055+buf0-bot[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 00:14:10 -0700 Subject: [PATCH] fix(cli): make ProfileCreate.scope strict (pr-bug-scan #1397) (#1497) Replace ProfileCreate.scope coerce-to-isolated transform with strict z.enum(['isolated', 'imported']) so unknown scopes surface validation errors instead of being silently rewritten. Supersedes #1455 (which was branched off stale main and would have reverted #1396). Co-authored-by: Jinjing --- src/main/runtime/rpc/methods/browser-schemas.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/runtime/rpc/methods/browser-schemas.ts b/src/main/runtime/rpc/methods/browser-schemas.ts index ab1190785..13ba12aeb 100644 --- a/src/main/runtime/rpc/methods/browser-schemas.ts +++ b/src/main/runtime/rpc/methods/browser-schemas.ts @@ -122,15 +122,9 @@ export const TabProfileClone = BrowserTarget.extend({ export const ProfileCreate = z.object({ label: requiredString('Missing required --label'), - scope: z - .unknown() - .transform((value) => { - if (value === 'imported') { - return 'imported' - } - return 'isolated' - }) - .pipe(z.enum(['isolated', 'imported'])) + // Strict enum so unknown scope values surface validation errors instead of being + // silently coerced to 'isolated' (pr-bug-scan finding from #1397). + scope: z.enum(['isolated', 'imported']) }) export const ProfileDelete = z.object({