fix potential vulnerability - codeql

deepsource-autofix-76c6eb20
Dan Gowans 2022-08-22 15:39:47 -04:00
parent 551dcc5cbf
commit 7d6ab7cc87
2 changed files with 9 additions and 2 deletions

View File

@ -36,7 +36,10 @@ router.route("/")
.post(async (request, response) => {
const userName = request.body.userName;
const passwordPlain = request.body.password;
const redirectURL = getSafeRedirectURL(request.body.redirect);
const unsafeRedirectURL = request.body.redirect;
const redirectURL = getSafeRedirectURL(typeof (unsafeRedirectURL) === "string" ?
unsafeRedirectURL :
"");
const isAuthenticated = await authenticationFunctions.authenticate(userName, passwordPlain);
let userObject;
if (isAuthenticated) {

View File

@ -59,7 +59,11 @@ router.route("/")
const userName = request.body.userName as string;
const passwordPlain = request.body.password as string;
const redirectURL = getSafeRedirectURL(request.body.redirect);
const unsafeRedirectURL = request.body.redirect;
const redirectURL = getSafeRedirectURL(typeof (unsafeRedirectURL) === "string" ?
unsafeRedirectURL :
"");
const isAuthenticated = await authenticationFunctions.authenticate(userName, passwordPlain)
let userObject: recordTypes.User;