Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo branch 1 #27

Merged
merged 3 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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,8 +53,8 @@ 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) {
if (users.length > 0) {
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