From 97017472142d2bd32e5b44eef28fd34844ffe659 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 7 Apr 2025 23:15:06 -0400 Subject: [PATCH] fix(security): mitigate CodeQL alerts by adding SRI attributes and sanitizing DOM content --- index.html | 11 +-- js/fileEditor.js | 6 +- js/filePreview.js | 16 +++- js/folderManager.js | 178 +++++++++++++++++++++++++++----------------- 4 files changed, 131 insertions(+), 80 deletions(-) diff --git a/index.html b/index.html index 4baef0e..4dfe64f 100644 --- a/index.html +++ b/index.html @@ -23,11 +23,12 @@ - - - - - + + + + + + diff --git a/js/fileEditor.js b/js/fileEditor.js index c4dff5f..c1dd372 100644 --- a/js/fileEditor.js +++ b/js/fileEditor.js @@ -1,5 +1,5 @@ // editor.js -import { showToast } from './domUtils.js'; +import { escapeHTML, showToast } from './domUtils.js'; import { loadFileList } from './fileListView.js'; function getModeForFile(fileName) { @@ -73,14 +73,14 @@ export function editFile(fileName, folder) { modal.classList.add("modal", "editor-modal"); modal.innerHTML = `
-

Editing: ${fileName}

+

Editing: ${escapeHTML(fileName)}

- +