diff --git a/Resource/Js/Admin.js b/Resource/Js/Admin.js index 2940177..7844c92 100644 --- a/Resource/Js/Admin.js +++ b/Resource/Js/Admin.js @@ -14,8 +14,12 @@ function getRootPath() { //判断url是否在iframe打开 if (window.frames.length == parent.frames.length) { - //alert('不在iframe中' + window.document.location.href); - window.location.replace(getRootPath() + '/Views/Default?url=' + encodeURIComponent(window.document.location.href)); + // Validate the URL to prevent Open Redirect + var currentUrl = window.document.location.href; + var allowedDomain = getRootPath(); + if (currentUrl.startsWith(allowedDomain)) { + window.location.replace(getRootPath() + '/Views/Default?url=' + encodeURIComponent(currentUrl)); + } //window.location.replace(getRootPath() + '/Views/Default?url=' + window.document.location.href); } diff --git a/Resource/fullcalendar/examples/google-calendar.html b/Resource/fullcalendar/examples/google-calendar.html index b6a686a..ff5f4d0 100644 --- a/Resource/fullcalendar/examples/google-calendar.html +++ b/Resource/fullcalendar/examples/google-calendar.html @@ -22,7 +22,7 @@ // THIS KEY WON'T WORK IN PRODUCTION!!! // To make your own Google API key, follow the directions here: // http://fullcalendar.io/docs/google_calendar/ - googleCalendarApiKey: 'AIzaSyDcnW6WejpTOCffshGDDb4neIrXVUA1EAE', + googleCalendarApiKey: process.env.GOOGLE_CALENDAR_API_KEY, // US Holidays events: 'en.usa#holiday@group.v.calendar.google.com', diff --git a/Scripts/WebForms/SmartNav.js b/Scripts/WebForms/SmartNav.js index 23b6487..439278f 100644 --- a/Scripts/WebForms/SmartNav.js +++ b/Scripts/WebForms/SmartNav.js @@ -31,7 +31,10 @@ if ((typeof(window.__smartNav) == "undefined") || (window.__smartNav == null)) var fdurlb = fdurl.split("?")[0]; if (document.location.href.indexOf(fdurlb) < 0) { - document.location.href=fdurl; + // Ensure the URL is within the expected domain + if (fdurl.startsWith(window.location.origin)) { + document.location.href = fdurl; + } return; } sn._savedOnLoad = window.onload; diff --git a/Views/Default.aspx b/Views/Default.aspx index a624f6f..8e9b49e 100644 --- a/Views/Default.aspx +++ b/Views/Default.aspx @@ -73,7 +73,7 @@ <%----%> - <%= Notice %> + <%= HttpUtility.HtmlEncode(Notice) %>