Skip to content

Commit 6a651b7

Browse files
Merge pull request #4720 from stennie/signin
Improve sanity checking for signin "from" param
2 parents eb7c1bb + 27aa760 commit 6a651b7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

admin/client/Signin/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import React from 'react';
1010
import ReactDOM from 'react-dom';
1111
import Signin from './Signin';
1212

13+
// Sanitize from param
14+
const internalFromRegex = /^\/[^\/\\]\w+/;
1315
const params = qs.parse(window.location.search.replace(/^\?/, ''));
14-
const from = typeof params.from === 'string' && params.from.charAt(0) === '/'
15-
? params.from : undefined;
16+
const from = internalFromRegex.test(params.from) ? params.from : undefined;
1617

1718
ReactDOM.render(
1819
<Signin

0 commit comments

Comments
 (0)