From 952d14a83a79ed8f99674cdea19cea43f64cdaf8 Mon Sep 17 00:00:00 2001 From: abhinav-phi Date: Thu, 17 Sep 2026 15:58:24 +0530 Subject: [PATCH 1/3] Modernize module iframes while preserving dashboard flow (#914) Replace deprecated frameborder string injection with DOM-created sandboxed frames. Adds title, loading lazy, referrerpolicy same-origin, and same-origin sandbox that blocks top navigation but keeps scripts, forms, modals, popups and downloads for training content. Adds same-origin src validation and fixes getStarted double-html handling. No Java or session logic changed. --- src/main/webapp/css/theCss.css | 1 + src/main/webapp/getStarted.jsp | 21 +++++++--- src/main/webapp/index.jsp | 76 ++++++++++++++++++++++++++++++---- 3 files changed, 84 insertions(+), 14 deletions(-) diff --git a/src/main/webapp/css/theCss.css b/src/main/webapp/css/theCss.css index 748ce84e0..ff4d66355 100644 --- a/src/main/webapp/css/theCss.css +++ b/src/main/webapp/css/theCss.css @@ -390,6 +390,7 @@ a:hover { word-wrap: break-word; width: 100%; height: 2056px; + border: 0; } .levelList { diff --git a/src/main/webapp/getStarted.jsp b/src/main/webapp/getStarted.jsp index 579f4fb6d..c2ef4e98a 100644 --- a/src/main/webapp/getStarted.jsp +++ b/src/main/webapp/getStarted.jsp @@ -199,12 +199,23 @@ else var theRefreshError = "Could not Refresh Menu"; $('#getStarted').slideDown("slow"); - $('#cantSee').html(""); - $('#cantSee').html(function(){ - $("#theStart").load(function(){ - $("#contentDiv").slideDown("slow"); - }); + // Issue 914: keep same-origin sandboxed frame for readyToPlay welcome view. + // readyToPlay is a full document with its own session check, so it stays + // isolated in the frame while dashboard navigation and session handling + // stay outside. Replaces deprecated frameborder string injection. + $("#cantSee").empty(); + var startFrame = document.createElement("iframe"); + startFrame.setAttribute("id", "theStart"); + startFrame.setAttribute("class", "levelIframe"); + startFrame.setAttribute("title", "Security Shepherd getting started"); + startFrame.setAttribute("loading", "lazy"); + startFrame.setAttribute("referrerpolicy", "same-origin"); + startFrame.setAttribute("sandbox", "allow-same-origin allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-downloads"); + startFrame.setAttribute("src", "readyToPlay.jsp"); + $(startFrame).on("load", function(){ + $("#contentDiv").slideDown("slow"); }); + $("#cantSee").append(startFrame); <% if (isAdmin) { %> $("#allApplication").click(function(){ if ($('#unsafeLevels').is(":checked")) diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index f751bc971..8aa064831 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -770,6 +770,43 @@ if (request.getSession() != null) %>