diff --git a/app/routes/contributions.js b/app/routes/contributions.js index 7f68170b94..8114678fe8 100644 --- a/app/routes/contributions.js +++ b/app/routes/contributions.js @@ -28,11 +28,10 @@ function ContributionsHandler(db) { this.handleContributionsUpdate = (req, res, next) => { /*jslint evil: true */ - // Insecure use of eval() to parse inputs - const preTax = eval(req.body.preTax); - const afterTax = eval(req.body.afterTax); - const roth = eval(req.body.roth); - + // Secure parsing of numeric inputs + const preTax = parseFloat(req.body.preTax) || 0; + const afterTax = parseFloat(req.body.afterTax) || 0; + const roth = parseFloat(req.body.roth) || 0; /* //Fix for A1 -1 SSJS Injection attacks - uses alternate method to eval const preTax = parseInt(req.body.preTax); diff --git a/app/routes/index.js b/app/routes/index.js index a9e55426bf..fdf5df4f1f 100644 --- a/app/routes/index.js +++ b/app/routes/index.js @@ -69,7 +69,14 @@ const index = (app, db) => { // Handle redirect for learning resources link app.get("/learn", isLoggedIn, (req, res) => { // Insecure way to handle redirects by taking redirect url from query string - return res.redirect(req.query.url); + const allowedUrls = ['/dashboard', '/profile', '/settings', '/courses']; + const redirectUrl = req.query.url; + + if (!redirectUrl || !allowedUrls.includes(redirectUrl)) { + return res.redirect('/dashboard'); + } + + return res.redirect(redirectUrl); }); // Research Page diff --git a/app/views/benefits.html b/app/views/benefits.html index 40e9b45bee..35808d34d4 100644 --- a/app/views/benefits.html +++ b/app/views/benefits.html @@ -52,6 +52,7 @@