mirror of
https://github.com/github/codeql.git
synced 2026-05-04 13:15:21 +02:00
JS: Add DeepResourceExhaustion test
This commit is contained in:
@@ -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 |
|
||||
@@ -0,0 +1 @@
|
||||
Security/CWE-400/DeepObjectResourceExhaustion.ql
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user