From d785329e74cee04eb57af5ea3fc0e0a38fed6294 Mon Sep 17 00:00:00 2001 From: Sebastian Danielsson Date: Sun, 27 Sep 2026 23:50:19 +0200 Subject: [PATCH] fix(layout): escape every bracket and paren in footer package links String replace() only replaced the first `[`, `]`, `(` and `)`, and link text backslashes were left as is. Use global regexes and escape backslashes too. Fixes CodeQL js/incomplete-sanitization alerts in the tool layout. Co-Authored-By: Claude Opus 5.5 --- src/layouts/tool.layout.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/tool.layout.vue b/src/layouts/tool.layout.vue index 5c77b067..aeba3136 100644 --- a/src/layouts/tool.layout.vue +++ b/src/layouts/tool.layout.vue @@ -62,7 +62,7 @@ const toolTitle = computed(() => t(`tools.${i18nKey.value}.title`, Strin const toolDescription = computed(() => t(`tools.${i18nKey.value}.description`, String(route.meta.description))); const toolFooter = computed(() => { const createLink = (linkText: string, url: string) => { - return `[${linkText.replace('[', '\\[').replace(']', '\\]')}](${url.replace('(', '%28').replace(')', '%29')})`; + return `[${linkText.replace(/[\\[\]]/g, '\\$&')}](${url.replace(/\(/g, '%28').replace(/\)/g, '%29')})`; }; let footer = t(`tools.${i18nKey.value}.footer`, String(route.meta.footer)); if (footer === 'undefined') {