fix: 🐛 add regex literal for isLocalHost check (#2484)
* fix: 🐛 add ':' to isLocalHost check ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13242 * refactor: 💡 use regex to verify href is localhost ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13242
This commit is contained in:
1 parent
9648e1fa3b
commit
fda3ca9d4b
1 file changed
+3
-2
@@ -44,9 +44,10 @@ 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://');
|
||||
const isLocalhost =
|
||||
href.startsWith('http://localhost') || href.startsWith('http://127.0.0.1');
|
||||
|
||||
if (isSecure || isLocalhost || isDev) {
|
||||
/**
|
||||
* Launch browser to display documentation and to support arbitrary OIDC flows
|
||||
|
||||
Reference in new issue
Block a user