[fix] UI: Error when clicking on 'Apps' in the application configuration

https://github.com/safing/portmaster/issues/1721
This commit is contained in:
Alexandr Stelnykovych
2025-01-31 17:50:00 +02:00
parent f021ec2444
commit d8108bff0e
2 changed files with 8 additions and 2 deletions

View File

@@ -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;
}