JS: Add DeepResourceExhaustion test

This commit is contained in:
Asger Feldthaus
2021-03-02 13:56:28 +00:00
parent 88e5348da9
commit 6e0322dc60
3 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
nodes
| tst.js:9:29:9:36 | req.body |
| tst.js:9:29:9:36 | req.body |
| tst.js:9:29:9:36 | req.body |
edges
| tst.js:9:29:9:36 | req.body | tst.js:9:29:9:36 | req.body |
#select
| tst.js:9:29:9:36 | req.body | tst.js:9:29:9:36 | req.body | tst.js:9:29:9:36 | req.body | Denial of service caused by processing user input from $@ with $@. | tst.js:9:29:9:36 | req.body | here | tst.js:4:21:4:35 | allErrors: true | allErrors: true |

View File

@@ -0,0 +1 @@
Security/CWE-400/DeepObjectResourceExhaustion.ql

View File

@@ -0,0 +1,12 @@
import express from 'express';
import Ajv from 'ajv';
let ajv = new Ajv({ allErrors: true });
ajv.addSchema(require('./input-schema'), 'input');
var app = express();
app.get('/user/:id', function(req, res) {
if (!ajv.validate('input', req.body)) { // NOT OK
return;
}
});