Skip to content

Commit

Permalink
[docs] add whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-akira committed Aug 7, 2024
1 parent 822f4c0 commit 2572b3a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docs/redirect/redirect.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
const r = new URLSearchParams(window.location.search).get("r")
if(r) window.location.replace(r)
const allowedURLs = [
'ms-settings:*'
];

const r = new URLSearchParams(window.location.search).get('r');

const isAllowed = allowedURLs.some((url) => {
const regex = new RegExp('^' + url.replace(/\*/g, '.*') + '$');
return regex.test(r);
});

if(r && isAllowed) window.location.replace(r);

0 comments on commit 2572b3a

Please sign in to comment.