diff --git a/aas-web-ui/src/components/AppNavigation/AppNavigation.vue b/aas-web-ui/src/components/AppNavigation/AppNavigation.vue index 9adc88ae..7e7d1edf 100644 --- a/aas-web-ui/src/components/AppNavigation/AppNavigation.vue +++ b/aas-web-ui/src/components/AppNavigation/AppNavigation.vue @@ -422,15 +422,12 @@ } function validURL(str: string) { - var pattern = new RegExp( - '^(https?:\\/\\/)?' + // protocol - '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name - '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address - '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path - '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string - '(\\#[-a-z\\d_]*)?$', - 'i' - ); // fragment locator - return !!pattern.test(str); + try { + const url = new URL(str); + // Ensure we only accept web protocols (http/https) + return url.protocol === 'http:' || url.protocol === 'https:'; + } catch { + return false; + } }