scope 10mb body limit to /monitors/import/json only
Address review feedback: keep the global express.json() at the default 100kb and mount a route-scoped 10mb parser in front of it for /api/v1/monitors/import/json. Express matches middleware in registration order, so the import route uses the larger parser and every other endpoint keeps the tight default. No change in DoS surface for normal traffic.
This commit is contained in:
1 parent
f4177baed5
commit
9459edce00
1 file changed
+2
-1
+2
-1
@@ -54,7 +54,8 @@ export const createApp = ({
|
||||
|
||||
app.use(express.static(frontendPath));
|
||||
|
||||
app.use(express.json({ limit: "10mb" }));
|
||||
app.use("/api/v1/monitors/import/json", express.json({ limit: "10mb" }));
|
||||
app.use(express.json());
|
||||
app.use(cookieParser());
|
||||
|
||||
app.use(sanitizeBody());
|
||||
|
||||
Reference in new issue
Block a user