From dba05d994474f328a6d33a4b70b8c04ceba49391 Mon Sep 17 00:00:00 2001 From: DaleBinghamSoteriaSoft Date: Mon, 6 Nov 2023 08:56:56 -0500 Subject: [PATCH] handle special characters correctly --- js/openrmf.js | 4 ++-- js/openrmf.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/openrmf.js b/js/openrmf.js index 7065499..1bf8858 100644 --- a/js/openrmf.js +++ b/js/openrmf.js @@ -420,7 +420,7 @@ async function getSystemListing(){ systemsListing += 'title="View the system package information and checklists" >' + item.title + ' (' + item.numberOfChecklists + ')'; systemsListing += '
'; if (item.description) { - systemsListing += item.description; + systemsListing += htmlEscape(item.description); } else { systemsListing += "(No description)" } @@ -482,7 +482,7 @@ async function getSystemRecord(systemGroupId) { $("#divSystemTitle").html("Title: " + item.title); $("#frmSystemTitle").val(item.title); if (item.description){ - $("#divSystemDescription").html("Description: " + item.description); + $("#divSystemDescription").html("Description: " + htmlEscape(item.description)); $("#frmSystemDescription").val(item.description); } else diff --git a/js/openrmf.min.js b/js/openrmf.min.js index 3a12428..d246cab 100644 --- a/js/openrmf.min.js +++ b/js/openrmf.min.js @@ -1 +1 @@ -function setupOpenRMFUI(e){$("#main").show(),"undefined"!=typeof keycloak&&(setupTimers(),$("#includeAutoLogin").load("/includes/modalLogout.html")),$("#includeNavBarLink").load("/includes/navbar.html"),$("#includeSidebarLink").load("/includes/sidebarmenu.html"),$("#includeFooterLink").load("/includes/footertext.html"),$.ajaxSetup({beforeSend:function(e){e.setRequestHeader("Authorization","Bearer "+keycloak.token)}})}function menuMetricsLink(){urlMetricsMenuLink?window.open(urlMetricsMenuLink,"openrmf-metrics"):alert("The Metrics menu has not been configured yet.")}function menuKeycloakLink(){urlKeycloakMenuLink?window.open(urlKeycloakMenuLink,"openrmf-users"):alert("The Users menu has not been configured yet.")}var warningTimerID,timeoutTimerID,keycloakTimerID,warningTimeout=84e4,timeoutNow=6e4,keycloakTimeout=295e3,bWarningAutoLogout=!1;function startLogoutTimer(){warningTimerID=window.setTimeout(warningInactive,warningTimeout)}function startKeycloakUpdateTimer(){keycloakTimerID=window.setTimeout(updateKeycloakToken,keycloakTimeout)}function warningInactive(){bWarningAutoLogout=!0,window.clearTimeout(warningTimerID),timeoutTimerID=window.setTimeout(IdleTimeout,timeoutNow),$("#modalAutoLogout").modal("show")}function resetLogoutTimer(){bWarningAutoLogout||(window.clearTimeout(timeoutTimerID),window.clearTimeout(warningTimerID),startLogoutTimer())}function updateKeycloakToken(){keycloak.updateToken(300).success((()=>{window.clearTimeout(keycloakTimerID),startKeycloakUpdateTimer()})).error((()=>{console.log("Keycloak token refresh unsuccessful")}))}function IdleTimeout(){autoLogout()}function setupTimers(){document.addEventListener("mousemove",resetLogoutTimer,!1),document.addEventListener("mousedown",resetLogoutTimer,!1),document.addEventListener("keypress",resetLogoutTimer,!1),document.addEventListener("touchmove",resetLogoutTimer,!1),document.addEventListener("onscroll",resetLogoutTimer,!1),startLogoutTimer(),startKeycloakUpdateTimer()}function logout(){var e={redirectUri:document.location.protocol+"//"+document.location.host+"/logout.html"};keycloak.logout(e).then((e=>{console.log("--\x3e log: logout success ",e)})).catch((e=>{console.log("--\x3e log: logout error ",e)}))}function autoLogout(){var e={redirectUri:document.location.protocol+"//"+document.location.host+"/logout.html?autologout=true"};keycloak.logout(e).then((e=>{console.log("--\x3e log: logout success ",e)})).catch((e=>{console.log("--\x3e log: logout error ",e)}))}function openProfile(){location.href=keycloak.createAccountUrl()}async function getSystemTotalCount(){let e=await fetch(readAPI+"count/systems",{headers:{Authorization:"Bearer "+keycloak.token}});if(e.ok){var t=await e.json();$("#numberSystemsTotal").html(t),$("#numberNewSystemsTotal").text(t)}else $("#numberSystemsTotal").html("error"),$("#numberNewSystemsTotal").text("error"),401==e.status?swal("There is an Authentication problem. Please logout and log back in. And have the application administrator verify your API's authentication settings.","Click OK to continue!","error"):401==e.status&&swal("There is an application problem. Please have the application administrator verify your system is 100% healthy and running correctly.","Click OK to continue!","error")}async function getChecklistTotalCount(){let e=await fetch(readAPI+"count/artifacts",{headers:{Authorization:"Bearer "+keycloak.token}});if(e.ok){var t=await e.json();$("#numberChecklistsTotal").html(t),$("#numberNewChecklistsTotal").text(t)}else $("#numberChecklistsTotal").html("error"),$("#numberNewChecklistsTotal").text("error"),401==e.status?swal("There is an Authentication problem. Please logout and log back in. And have the application administrator verify your API's authentication settings.","Click OK to continue!","error"):401==e.status&&swal("There is an application problem. Please have the application administrator verify your system is 100% healthy and running correctly.","Click OK to continue!","error")}async function getTemplateTotalCount(){let e=await fetch(templateAPI+"count/templates",{headers:{Authorization:"Bearer "+keycloak.token}});if(e.ok){var t=await e.json();$("#numberTemplatesTotal").html(t),$("#numberNewTemplatesTotal").text(t)}else $("#numberTemplatesTotal").html("error"),$("#numberNewTemplatesTotal").text("error"),401==e.status?swal("There is an Authentication problem. Please logout and log back in. And have the application administrator verify your API's authentication settings.","Click OK to continue!","error"):401==e.status&&swal("There is an application problem. Please have the application administrator verify your system is 100% healthy and running correctly.","Click OK to continue!","error")}async function getSystemsForDashboard(){sessionStorage.removeItem("checklistSystems"),$("#checklistSystem").children().remove().end(),$("#checklistSystem").append(''),$("#checklistACASSystem").children().remove().end(),$("#checklistACASSystem").append('');var e=await getChecklistSystems();e&&$.each(e,(function(e,t){optionString='",$("#checklistSystem").append(optionString),$("#checklistACASSystem").append(optionString)}))}async function getSystemOpenItemsForDashboard(){var e=$("#checklistSystem").val();if(e){$("#divSystemCategoryDashboard").show();var t=await getScoreForSystemChecklistListing(e);t&&($("#numberCAT1Open").html(t.totalCat1Open),$("#numberCAT1OpenItems").text(t.totalCat1Open),$("#numberCAT2Open").html(t.totalCat2Open),$("#numberCAT2OpenItems").text(t.totalCat2Open),$("#numberCAT3Open").html(t.totalCat3Open),$("#numberCAT3OpenItems").text(t.totalCat3Open))}else $("#divSystemCategoryDashboard").hide()}function loadSystemFromDashboardCategory(e){var t=$("#checklistSystem").val();t&&(location.href="checklists.html?id="+t+"&category="+e)}async function getSystemACASItemsForDashboard(){var e=$("#checklistACASSystem").val();if(e){var t=await getNessusFileSummaryData(e);t?($("#divSystemACASPatchListing").show(),$("#divNessusStatus").hide(),$("#numberCriticalOpen").html(t.totalCriticalOpen),$("#numberHighOpen").html(t.totalHighOpen),$("#numberMediumOpen").html(t.totalMediumOpen),$("#numberLowOpen").html(t.totalLowOpen)):($("#divSystemACASPatchListing").hide(),$("#divNessusStatus").html("There is no current Nessus patch file loaded for this system package."),$("#divNessusStatus").show())}else $("#divSystemACASPatchListing").hide(),$("#divNessusStatus").html("There is no current valid Nessus patch file loaded for this system."),$("#divNessusStatus").show()}async function getTemplates(e){$.blockUI({message:"Updating the template listing...please wait",css:{padding:"15px"}}),$("#tblChecklistListing").DataTable().ajax.url(templateAPI).load(finalizeLoadingTable)}async function getScoreForTemplateListing(e){var t=new FormData;t.append("rawChecklist",e),$.ajax({url:scoreAPI,data:t,type:"POST",beforeSend:function(e){e.setRequestHeader("Authorization","Bearer "+keycloak.token)},processData:!1,contentType:!1,success:function(e){displayChecklistScores(e)}})}async function deleteTemplate(e){e&&e.length>10&&swal({title:"Delete this Template?",text:"Are you sure you wish to delete this template?",icon:"warning",buttons:!0,dangerMode:!0}).then((t=>{t?$.ajax({url:templateAPI+e,type:"DELETE",beforeSend:function(e){e.setRequestHeader("Authorization","Bearer "+keycloak.token)},success:function(e){swal("Your Template was deleted successfully!","Click OK to continue!","success").then((e=>{location.href="templates.html"}))},error:function(e){swal("There was a Problem. Your Template was not deleted successfully! Please check with the Application Admin.","Click OK to continue!","error")}}):swal("Canceled the Deletion.")}))}async function getChecklistSystemsForChecklistCreation(){var e=await getChecklistSystems();e&&$.each(e,(function(e,t){$("#checklistSystemPackage").append($("