diff --git a/app/routes/contributions.js b/app/routes/contributions.js index 7f68170b94..21f7fd25c6 100644 --- a/app/routes/contributions.js +++ b/app/routes/contributions.js @@ -29,7 +29,19 @@ function ContributionsHandler(db) { /*jslint evil: true */ // Insecure use of eval() to parse inputs - const preTax = eval(req.body.preTax); +const preTax = parseFloat(req.body.preTax); +const preTax = parseFloat(req.body.preTax); +const preTax = parseFloat(req.body.preTax); +const afterTax = parseFloat(req.body.afterTax); +const roth = parseFloat(req.body.roth); +const afterTax = parseFloat(req.body.afterTax); +const roth = parseFloat(req.body.roth); +const roth = parseFloat(req.body.roth); +const afterTax = parseFloat(req.body.afterTax); +const roth = parseFloat(req.body.roth); +const roth = parseFloat(req.body.roth); +const afterTax = parseFloat(req.body.afterTax); +const roth = parseFloat(req.body.roth); const afterTax = eval(req.body.afterTax); const roth = eval(req.body.roth); diff --git a/app/routes/index.js b/app/routes/index.js index a9e55426bf..8bde3556ad 100644 --- a/app/routes/index.js +++ b/app/routes/index.js @@ -69,7 +69,20 @@ 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 = [ + 'https://example.com/learn', + 'https://example.com/docs', + // Add more allowed URLs as needed +]; + +app.get("/learn", isLoggedIn, (req, res) => { + const redirectUrl = req.query.url; + if (allowedUrls.includes(redirectUrl)) { + return res.redirect(redirectUrl); + } else { + return res.status(400).send('Invalid redirect URL'); + } +}); }); // Research Page diff --git a/app/views/benefits.html b/app/views/benefits.html index 40e9b45bee..7356c42ef4 100644 --- a/app/views/benefits.html +++ b/app/views/benefits.html @@ -51,7 +51,21 @@