From 6ce18a24bc9a3959a2995db44eea9d213b20252c Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 7 Sep 2026 12:11:46 +0000 Subject: [PATCH] fix(cli): log UID resolution failures in sentry cli fix instead of silently returning null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The resolveUid function catches execFileSync failures silently, returning null without any diagnostic output. When `sudo sentry cli fix` cannot determine the real user's UID, it bails early with a generic message ("Could not determine a non-root UID") but never logs the underlying system error (e.g., unknown username, missing `id` binary, permission denied). Add log.debug() to surface the username and error, and remove the grandfathered biome-ignore suppression. Co-authored-by: Miguel Betegón --- packages/cli/src/commands/cli/fix.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/commands/cli/fix.ts b/packages/cli/src/commands/cli/fix.ts index 1b3083255..f4554445a 100644 --- a/packages/cli/src/commands/cli/fix.ts +++ b/packages/cli/src/commands/cli/fix.ts @@ -18,6 +18,7 @@ import { import { OutputError } from "../../lib/errors.js"; import { formatFixResult } from "../../lib/formatters/human.js"; import { CommandOutput } from "../../lib/formatters/output.js"; +import { logger } from "../../lib/logger.js"; import { getRealUsername } from "../../lib/utils.js"; type FixFlags = { @@ -251,8 +252,9 @@ async function checkOwnership( * Uses `execFileSync` (not `execSync`) so the username is passed as a * separate argument — the shell never interpolates it, preventing injection. */ +const log = logger.withTag("cli.fix"); + function resolveUid(username: string): number | null { - // biome-ignore lint/plugin: grandfathered silent catch — see #1531; drain by adding log.debug()/log.warn() or re-throwing. try { const result = execFileSync("id", ["-u", "--", username], { encoding: "utf-8", @@ -260,7 +262,8 @@ function resolveUid(username: string): number | null { }); const uid = Number(result.trim()); return Number.isNaN(uid) ? null : uid; - } catch { + } catch (error) { + log.debug(`Failed to resolve UID for user "${username}"`, error); return null; } }