Skip to content
Merged
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
8 changes: 4 additions & 4 deletions app/routes/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,18 @@ function SessionHandler(db) {
const invalidPasswordErrorMessage = "Invalid password";
if (err) {
if (err.noSuchUser) {
console.log("Error: attempt to login with invalid user: ", userName);
// console.log("Error: attempt to login with invalid user: ", userName);

// Fix for A1 - 3 Log Injection - encode/sanitize input for CRLF Injection
// that could result in log forging:
// - Step 1: Require a module that supports encoding
// const ESAPI = require('node-esapi');
const ESAPI = require('node-esapi');
// - Step 2: Encode the user input that will be logged in the correct context
// following are a few examples:
// console.log('Error: attempt to login with invalid user: %s',
// ESAPI.encoder().encodeForHTML(userName));
// console.log('Error: attempt to login with invalid user: %s',
// ESAPI.encoder().encodeForJavaScript(userName));
console.log('Error: attempt to login with invalid user: %s',
ESAPI.encoder().encodeForJavaScript(userName));
// console.log('Error: attempt to login with invalid user: %s',
// ESAPI.encoder().encodeForURL(userName));
// or if you know that this is a CRLF vulnerability you can target this specifically as follows:
Expand Down