add another indirect route-handler test

This commit is contained in:
Erik Krogh Kristensen
2020-09-16 09:53:30 +02:00
parent 43e5c0212c
commit dafcd59148
2 changed files with 17 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
| MissingCsrfMiddlewareBad.js:7:9:7:22 | cookieParser() | This cookie middleware is serving a request handler $@ without CSRF protection. | MissingCsrfMiddlewareBad.js:10:26:12:1 | functio ... il"];\\n} | here |
| MissingCsrfMiddlewareBad.js:17:13:17:26 | cookieParser() | This cookie middleware is serving a request handler $@ without CSRF protection. | MissingCsrfMiddlewareBad.js:25:30:27:6 | errorCa ... \\n }) | here |
| MissingCsrfMiddlewareBad.js:33:13:33:26 | cookieParser() | This cookie middleware is serving a request handler $@ without CSRF protection. | MissingCsrfMiddlewareBad.js:41:30:43:6 | errorCa ... \\n }) | here |
| csurf_api_example.js:42:37:42:50 | cookieParser() | This cookie middleware is serving a request handler $@ without CSRF protection. | csurf_api_example.js:42:53:45:3 | functio ... e')\\n } | here |
| csurf_example.js:18:9:18:22 | cookieParser() | This cookie middleware is serving a request handler $@ without CSRF protection. | csurf_example.js:31:40:34:1 | functio ... sed')\\n} | here |
| lusca_example.js:9:9:9:22 | cookieParser() | This cookie middleware is serving a request handler $@ without CSRF protection. | lusca_example.js:26:42:29:1 | functio ... sed')\\n} | here |

View File

@@ -26,3 +26,19 @@ app.post('/changeEmail', function (req, res) {
let newEmail = req.cookies["newEmail"];
}));
})
(function () {
var app = express();
app.use(cookieParser());
app.use(passport.authorize({ session: true }));
const errorCatch = (fn) =>
(req, res, next) => {
fn.call(this, req, res, next).catch((e) => console.log("Caught " + e));
};
app.post('/changeEmail', errorCatch(async function (req, res) {
let newEmail = req.cookies["newEmail"];
}));
})