mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
This query flags the cookie-parsing middleware in order to consolidate huge numbers of alerts into a single alert, which is more manageable. But simply annotating the cookie-parsing middleware with 'Alert' isn't a very useful, we want to annotate which middlewares are vulnerable.
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
var express = require('express')
|
|
var cookieParser = require('cookie-parser')
|
|
var bodyParser = require('body-parser')
|
|
|
|
var parseForm = bodyParser.urlencoded({ extended: false })
|
|
var lusca = require('lusca');
|
|
|
|
var app = express()
|
|
app.use(cookieParser()) // $ Alert
|
|
|
|
app.post('/process', parseForm, lusca.csrf(), function (req, res) { // OK
|
|
let newEmail = req.cookies["newEmail"];
|
|
res.send('data is being processed')
|
|
})
|
|
|
|
app.post('/process', parseForm, lusca({csrf:true}), function (req, res) { // OK
|
|
let newEmail = req.cookies["newEmail"];
|
|
res.send('data is being processed')
|
|
})
|
|
|
|
app.post('/process', parseForm, lusca({csrf:{}}), function (req, res) { // OK
|
|
let newEmail = req.cookies["newEmail"];
|
|
res.send('data is being processed')
|
|
})
|
|
|
|
app.post('/process', parseForm, lusca(), function (req, res) { // missing csrf option
|
|
let newEmail = req.cookies["newEmail"];
|
|
res.send('data is being processed')
|
|
}) // $ RelatedLocation
|
|
|
|
app.post('/process_unsafe', parseForm, function (req, res) {
|
|
let newEmail = req.cookies["newEmail"];
|
|
res.send('data is being processed')
|
|
}) // $ RelatedLocation
|