Skip to content

Commit

Permalink
Dylan Fixing Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DefenderK committed Jul 15, 2024
1 parent 627f4e7 commit c782d6e
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 15 deletions.
131 changes: 123 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"test": "snyk test"
},
"dependencies": {
"adm-zip": "0.4.7",
"adm-zip": "0.5.2",
"body-parser": "1.9.0",
"cfenv": "^1.0.4",
"consolidate": "0.14.5",
Expand Down Expand Up @@ -46,7 +46,8 @@
"stream-buffers": "^3.0.1",
"tap": "^11.1.3",
"typeorm": "^0.2.24",
"validator": "^13.5.2"
"validator": "^13.5.2",
"stimulus_reflex": "3.4.1"
},
"devDependencies": {
"browserify": "^13.1.1",
Expand Down
12 changes: 7 additions & 5 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ exports.index = function (req, res, next) {
};

// Insert new vulnerable code:

/*
exports.loginHandler = function (req, res, next) {
if (validator.isEmail(req.body.username)) {
Expand Down Expand Up @@ -70,8 +70,10 @@ if (validator.isEmail(req.body.username)) {
return res.status(401).send()
};
*/

// Fixed code: validator.escape() is used to sanitize the input parameters (username and password) before using them in the database query.
/*

exports.loginHandler = function (req, res, next) {
// Validate if the username is in email format
if (validator.isEmail(req.body.username)) {
Expand Down Expand Up @@ -99,7 +101,7 @@ exports.loginHandler = function (req, res, next) {
return res.status(401).send("Unauthorized");
}
};
*/


function adminLoginSuccess(redirectPage, session, username, res) {
session.loggedIn = 1
Expand Down Expand Up @@ -238,7 +240,7 @@ exports.create = function (req, res, next) {
};

// Insert new vulnerable code:
/*

exports.destroy = function (req, res, next) {
Todo.findById(req.params.id, function (err, todo) {

Expand Down Expand Up @@ -279,7 +281,7 @@ exports.update = function (req, res, next) {
});
});
};
*/


// ** express turns the cookie key to lowercase **
exports.current_user = function (req, res, next) {
Expand Down

0 comments on commit c782d6e

Please sign in to comment.