Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Dylan Fixing Issues
  • Loading branch information
Dylan Kruger committed Mar 10, 2024
commit 73e6fec97c2762da06d9beca1e35dbab77e82b97
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ app.set('view engine', 'ejs');
app.use(logger('dev'));
app.use(methodOverride());
app.use(session({
secret: 'keyboard cat',
// secret: 'keyboard cat',
name: 'connect.sid',
cookie: { path: '/' }
}))
Expand Down
11 changes: 8 additions & 3 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ exports.index = function (req, res, next) {
});
};

// Insert new vulnerable code:
/*

exports.loginHandler = function (req, res, next) {
if (validator.isEmail(req.body.username)) {
User.find({ username: req.body.username, password: req.body.password }, function (err, users) {
Expand All @@ -50,7 +53,7 @@ exports.loginHandler = function (req, res, next) {
return res.status(401).send()
}
};
// Insert new vuln


if (validator.isEmail(req.body.username)) {
User.find({ username: req.body.username, password: req.body.password }, function (err, users) {
Expand All @@ -66,7 +69,7 @@ if (validator.isEmail(req.body.username)) {
} else {
return res.status(401).send()
};

*/
function adminLoginSuccess(redirectPage, session, username, res) {
session.loggedIn = 1

Expand Down Expand Up @@ -203,6 +206,8 @@ 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 @@ -243,7 +248,7 @@ exports.update = function (req, res, next) {
});
});
};

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

Expand Down