Skip to content

Commit

Permalink
Allow configuring JSON request body size limits (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Nov 1, 2023
1 parent 1a5098c commit 69e847a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/routes/db.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict';

var jsonParser = require('body-parser').json({limit: '1mb'});
var jsonParser = require('body-parser').json({
// Be careful when increasing JSON size limits:
// https://cheatsheetseries.owasp.org/cheatsheets/Nodejs_Security_Cheat_Sheet.html#set-request-size-limits
limit: process.env.JSON_REQUEST_SIZE_LIMIT || '1mb',
});
var extend = require('extend');

var utils = require('../utils.js');
Expand Down
6 changes: 5 additions & 1 deletion lib/routes/document.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict';

var jsonParser = require('body-parser').json({limit: '1mb'});
var jsonParser = require('body-parser').json({
// Be careful when increasing JSON size limits:
// https://cheatsheetseries.owasp.org/cheatsheets/Nodejs_Security_Cheat_Sheet.html#set-request-size-limits
limit: process.env.JSON_REQUEST_SIZE_LIMIT || '1mb',
});
var multiparty = require('multiparty');
var Promise = require('bluebird');
var fs = fs = require('fs');
Expand Down

0 comments on commit 69e847a

Please sign in to comment.