From a560f67d20a443b3559b1bd9e564dcc457f3ab34 Mon Sep 17 00:00:00 2001 From: Eric Schoeller Date: Fri, 27 Mar 2026 21:34:39 -0600 Subject: [PATCH 1/3] Guard against undefined verificationUri and userCode in device code flow. Closes #7167 --- src/Auth.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Auth.ts b/src/Auth.ts index f567b1cb0ae..dad2cf0c4e7 100644 --- a/src/Auth.ts +++ b/src/Auth.ts @@ -462,7 +462,7 @@ export class Auth { await logger.logToStderr(`🌶️ ${response.message}`); } - if (cli.getSettingWithDefaultValue(settingsNames.autoOpenLinksInBrowser, false)) { + if (cli.getSettingWithDefaultValue(settingsNames.autoOpenLinksInBrowser, false) && response.verificationUri) { await browserUtil.open(response.verificationUri); } @@ -475,7 +475,9 @@ export class Auth { this._clipboardy = (await import('clipboardy')).default; } - this._clipboardy.writeSync(response.userCode); + if (response.userCode) { + this._clipboardy.writeSync(response.userCode); + } } } From aaeec8b220065e8fc219fb2962bf178c4fcfff66 Mon Sep 17 00:00:00 2001 From: Eric Schoeller Date: Sat, 28 Mar 2026 12:34:56 -0600 Subject: [PATCH 2/3] Use null checks instead of truthiness for verificationUri and userCode --- src/Auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Auth.ts b/src/Auth.ts index dad2cf0c4e7..96ac9412a7b 100644 --- a/src/Auth.ts +++ b/src/Auth.ts @@ -462,7 +462,7 @@ export class Auth { await logger.logToStderr(`🌶️ ${response.message}`); } - if (cli.getSettingWithDefaultValue(settingsNames.autoOpenLinksInBrowser, false) && response.verificationUri) { + if (cli.getSettingWithDefaultValue(settingsNames.autoOpenLinksInBrowser, false) && response.verificationUri != null) { await browserUtil.open(response.verificationUri); } @@ -475,7 +475,7 @@ export class Auth { this._clipboardy = (await import('clipboardy')).default; } - if (response.userCode) { + if (response.userCode != null) { this._clipboardy.writeSync(response.userCode); } } From 2bd7f62b57f3411c42dc0ef1a000ff3621a21052 Mon Sep 17 00:00:00 2001 From: Eric Schoeller Date: Mon, 30 Mar 2026 18:34:56 -0600 Subject: [PATCH 3/3] Use strict equality for eqeqeq lint rule --- src/Auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Auth.ts b/src/Auth.ts index 96ac9412a7b..2c2cc83f597 100644 --- a/src/Auth.ts +++ b/src/Auth.ts @@ -462,7 +462,7 @@ export class Auth { await logger.logToStderr(`🌶️ ${response.message}`); } - if (cli.getSettingWithDefaultValue(settingsNames.autoOpenLinksInBrowser, false) && response.verificationUri != null) { + if (cli.getSettingWithDefaultValue(settingsNames.autoOpenLinksInBrowser, false) && response.verificationUri !== undefined) { await browserUtil.open(response.verificationUri); } @@ -475,7 +475,7 @@ export class Auth { this._clipboardy = (await import('clipboardy')).default; } - if (response.userCode != null) { + if (response.userCode !== undefined) { this._clipboardy.writeSync(response.userCode); } }