Skip to content

Commit 4a7ad4a

Browse files
authored
Merge pull request from GHSA-v98m-398x-269r
1 parent cdd4d2a commit 4a7ad4a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Umbraco.Web.UI.Client/src/views/common/login.controller.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ angular.module('umbraco').controller("Umbraco.LoginController", function (events
1111
//check if there's a returnPath query string, if so redirect to it
1212
var locationObj = $location.search();
1313
if (locationObj.returnPath) {
14-
path = decodeURIComponent(locationObj.returnPath);
14+
// ensure that the returnPath is a valid URL under the current origin (prevents DOM-XSS among other things)
15+
const returnPath = decodeURIComponent(locationObj.returnPath);
16+
const url = new URL(returnPath, window.location.origin);
17+
if (url.origin === window.location.origin) {
18+
path = returnPath;
19+
}
1520
}
1621

1722
// Ensure path is not absolute

0 commit comments

Comments
 (0)