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 2 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: 10000 });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array limit is 10,000 but, comment is 100?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that. Was testing 10000.

});

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