Skip to content

Commit 72f9199

Browse files
Kerwin SunKerwin Sun
authored andcommitted
xss fix
1 parent 26c4750 commit 72f9199

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/hello.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1513,11 +1513,20 @@ hello.utils.extend(hello.utils, {
15131513
// (URI Fragments within 302 Location URI are lost over HTTPS)
15141514
// Loading the redirect.html before triggering the OAuth Flow seems to fix it.
15151515
else if ('oauth_redirect' in p) {
1516+
var url = decodeURIComponent(p.oauth_redirect);
1517+
1518+
if (isValidUrl(url)) {
1519+
location.assign(url);
1520+
}
15161521

1517-
location.assign(decodeURIComponent(p.oauth_redirect));
15181522
return;
15191523
}
15201524

1525+
function isValidUrl(url) {
1526+
var regexp = /^https?:/;
1527+
return regexp.test(url);
1528+
}
1529+
15211530
// Trigger a callback to authenticate
15221531
function authCallback(obj, window, parent) {
15231532

0 commit comments

Comments
 (0)