From d8108bff0ecbddb53cb8a9b5f0a8a8a20fdf9e38 Mon Sep 17 00:00:00 2001 From: Alexandr Stelnykovych <stenya@gmail.com> Date: Fri, 31 Jan 2025 17:50:00 +0200 Subject: [PATCH] [fix] UI: Error when clicking on 'Apps' in the application configuration https://github.com/safing/portmaster/issues/1721 --- desktop/angular/src/app/pages/app-view/app-view.html | 2 +- desktop/angular/src/main.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/desktop/angular/src/app/pages/app-view/app-view.html b/desktop/angular/src/app/pages/app-view/app-view.html index 0bba8b7b..72a7ad81 100644 --- a/desktop/angular/src/app/pages/app-view/app-view.html +++ b/desktop/angular/src/app/pages/app-view/app-view.html @@ -3,7 +3,7 @@ <div class="flex justify-between items-center p-4 px-12 text-xxs"> <!-- Breadcrumbs --> <div class="flex items-center"> - <a class="text-secondary hover:text-primary" [routerLink]="['/app/overview']">Apps</a> + <div class="cursor-pointer text-secondary hover:text-primary" [routerLink]="['/app/overview']">Apps</div> <svg viewBox="0 0 24 24" class="inline-block w-4 h-4 text-secondary"> <g fill="none" class="inner" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.2" d="M10 16l4-4-4-4" /> diff --git a/desktop/angular/src/main.ts b/desktop/angular/src/main.ts index 1d83337d..f6fc9b2c 100644 --- a/desktop/angular/src/main.ts +++ b/desktop/angular/src/main.ts @@ -27,9 +27,15 @@ if (typeof (CSS as any)['registerProperty'] === 'function') { } function handleExternalResources(e: Event) { + // TODO: + // This code executes "openExternal()" when any "<a />" element in the app is clicked. + // This could potentially be a security issue. + // We should consider restricting this to only external links that belong to a certain domain (e.g., https://safing.io). + // get click target let target: HTMLElement | null = e.target as HTMLElement; - // traverse until we reach an a tag + + // traverse until we reach element "<a />" while (!!target && target.tagName !== "A") { target = target.parentElement; }