Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMR-10296: Adding arrayLimit to qs parser to increase the array limit without indices #389

Merged
merged 4 commits into from
Feb 5, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import helmet from "helmet";
import express from "express";
import compression from "compression";
import cookieParser from "cookie-parser";
import qs from "qs";

import * as dotenv from "dotenv";
dotenv.config();
Expand All @@ -14,6 +15,13 @@ import { notFoundHandler, errorHandler } from "./middleware";
const createApp = () => {
const app = express();

// This allows the query parser to parse up to 100 coordinates without adding indices.
// Anything over 100 would error out because indices are added. See CMR-10296 and
// https://github.com/ljharb/qs for more details.
app.set("query parser", function (str: string) {
return qs.parse(str, { arrayLimit: 100 });
});

app.use(compression());
app.use(helmet());
app.use(cors());
Expand Down