diff --git a/ui/admin/app/controllers/scopes/scope/authenticate/method/oidc.js b/ui/admin/app/controllers/scopes/scope/authenticate/method/oidc.js index 39f22f9ba..c64b230c3 100644 --- a/ui/admin/app/controllers/scopes/scope/authenticate/method/oidc.js +++ b/ui/admin/app/controllers/scopes/scope/authenticate/method/oidc.js @@ -3,12 +3,10 @@ * SPDX-License-Identifier: BUSL-1.1 */ -import Controller, { inject as controller } from '@ember/controller'; +import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; export default class ScopesScopeAuthenticateMethodOidcController extends Controller { - @controller('scopes/scope/authenticate/method/index') authMethod; - // =services @service session; diff --git a/ui/admin/app/templates/scopes/scope/authenticate/method/oidc.hbs b/ui/admin/app/templates/scopes/scope/authenticate/method/oidc.hbs index 8b0334f81..01d1d5256 100644 --- a/ui/admin/app/templates/scopes/scope/authenticate/method/oidc.hbs +++ b/ui/admin/app/templates/scopes/scope/authenticate/method/oidc.hbs @@ -12,7 +12,7 @@

{{t 'resources.auth-method.messages.pending.description'}}

{{t 'resources.auth-method.questions.no-see-window'}} - + {{t 'actions.retry'}}

diff --git a/ui/admin/tests/unit/controllers/scopes/scope/authenticate/method/oidc-test.js b/ui/admin/tests/unit/controllers/scopes/scope/authenticate/method/oidc-test.js index 547d001af..a615dc9a6 100644 --- a/ui/admin/tests/unit/controllers/scopes/scope/authenticate/method/oidc-test.js +++ b/ui/admin/tests/unit/controllers/scopes/scope/authenticate/method/oidc-test.js @@ -16,7 +16,6 @@ module( 'controller:scopes/scope/authenticate/method/oidc', ); assert.ok(controller); - assert.ok(controller.authMethod); }); }, ); diff --git a/ui/desktop/electron-app/src/index.js b/ui/desktop/electron-app/src/index.js index af35713b8..131c672f5 100644 --- a/ui/desktop/electron-app/src/index.js +++ b/ui/desktop/electron-app/src/index.js @@ -34,6 +34,7 @@ const menu = require('./config/menu.js'); const appUpdater = require('./helpers/app-updater.js'); const { isMac, isLinux, isWindows } = require('./helpers/platform.js'); const fixPath = require('./utils/fixPath'); +const isLocalhost = require('./utils/isLocalhost'); const config = require('../config/config.js'); const { version } = require('./cli/index.js'); const isDev = require('electron-is-dev'); @@ -160,6 +161,7 @@ const createWindow = (partition, closeWindowCB) => { // link to the release page for the desktop app. browserWindow.webContents.setWindowOpenHandler(({ url }) => { if ( + isLocalhost(url) || url.startsWith('https://developer.hashicorp.com/') || url.startsWith('https://releases.hashicorp.com/boundary-desktop/') ) { @@ -262,7 +264,7 @@ app.on('ready', async () => { appUpdater.run({ suppressNoUpdatePrompt: true }); /** - * Need for Mac OS behaviour of closing the window but not the app. + * Need for Mac OS behavior of closing the window but not the app. * This allows to reopen the window if the user clicks Boundary icon in the dock * while the app is not close. * More info: https://www.electronjs.org/docs/latest/tutorial/quick-start#open-a-window-if-none-are-open-macos diff --git a/ui/desktop/electron-app/src/ipc/handlers.js b/ui/desktop/electron-app/src/ipc/handlers.js index 6cd8263fa..a68dd9eb8 100644 --- a/ui/desktop/electron-app/src/ipc/handlers.js +++ b/ui/desktop/electron-app/src/ipc/handlers.js @@ -10,6 +10,7 @@ const boundaryCli = require('../cli/index.js'); const sessionManager = require('../services/session-manager.js'); const runtimeSettings = require('../services/runtime-settings.js'); const sanitizer = require('../utils/sanitizer.js'); +const isLocalhost = require('../utils/isLocalhost'); const { isLinux, isMac, isWindows } = require('../helpers/platform.js'); const os = require('node:os'); const pty = require('node-pty'); @@ -46,11 +47,9 @@ handle('resetClusterUrl', async () => runtimeSettings.resetClusterUrl()); * testing workflows). Insecure URLs are allowed in dev mode. */ handle('openExternal', async (href) => { - const localhostRegex = /^http:\/\/(localhost|127\.0\.0\.1):\d{1,5}(?:\/|$)/i; - const isLocalhost = localhostRegex.test(href); const isSecure = href.startsWith('https://'); - if (isSecure || isLocalhost || isDev) { + if (isSecure || isLocalhost(href) || isDev) { /** * Launch browser to display documentation and to support arbitrary OIDC flows * using openExternal. The protocol is validated (see above). diff --git a/ui/desktop/electron-app/src/utils/isLocalhost.js b/ui/desktop/electron-app/src/utils/isLocalhost.js new file mode 100644 index 000000000..fa4d2dabe --- /dev/null +++ b/ui/desktop/electron-app/src/utils/isLocalhost.js @@ -0,0 +1,11 @@ +/** + * Copyright (c) HashiCorp, Inc. + * SPDX-License-Identifier: BUSL-1.1 + */ + +const isLocalhost = (url) => { + const localhostRegex = /^http:\/\/(localhost|127\.0\.0\.1):\d{1,5}(?:\/|$)/i; + return localhostRegex.test(url); +}; + +module.exports = isLocalhost;