urBackend icon indicating copy to clipboard operation
urBackend copied to clipboard

[SECURITY] No request size limiting on API endpoints - DoS vulnerability

Open Siddh2024 opened this issue 5 months ago • 14 comments

Description

The API endpoints do not limit incoming request body sizes. An attacker can send extremely large payloads to exhaust server memory and CPU, causing a denial of service.

Suggested Fix

Implement request body size limits using middleware (e.g., body-parser limit option or nginx client_max_body_size).

Siddh2024 avatar Jun 20 '26 17:06 Siddh2024

Hi @Siddh2024,

I would like to work on this issue under GSSoC'26. I plan to implement request body size limits on the API endpoints to mitigate potential DoS attacks caused by excessively large payloads.

Could you please assign this issue to me?

Thank you!

aavishkarchaudhari avatar Jun 22 '26 13:06 aavishkarchaudhari

Hi @Siddh2024, @yash-pouranik! I'd like to work on this issue if it's still available. While implementing the fix, is there a preferred request body size limit (for example, 1 MB or 10 MB), or should I use a reasonable default? Thank you!

avadhesh11 avatar Jun 27 '26 11:06 avadhesh11

hi @Siddh2024 , can you mention those API endpoint which have no limitation ??

Ayush4958 avatar Jun 28 '26 10:06 Ayush4958

I feel most of the APIS doesnt check the payload size? @Ayush4958 @Siddh2024 @avadhesh11 @aavishkarchaudhari

Who ever wanna work? but please before working. u have to share the scope of the issue and all the endpoints that will effect including middleware.

yash-pouranik avatar Jun 28 '26 10:06 yash-pouranik

@yash-pouranik , I think @Siddh2024 had raised this issue so he's a suitable fit for it but before that he should make it very concise issue and also mention end point location and In PR body he should also mention what is expected payload for different endpoint and also the reason for the limiting the request body size

Ayush4958 avatar Jun 28 '26 11:06 Ayush4958

@Siddh2024 , some things to notice

If you are planning to create the middleware for limiting the body size make it dynamic so its usable for most of cases and also for the other API endpoint and to decide the limitation for request body size, research on it what size of data is standard it can receive it by user and also mention the reasoning in PR for limiting the request body size

Ayush4958 avatar Jun 28 '26 11:06 Ayush4958

Hi! This issue appears to be unassigned. Would it be possible to assign it to me for GSSoC '26? I'm interested in working on this and would be happy to submit a PR once assigned.

Thank you!

anshul23102 avatar Jun 28 '26 17:06 anshul23102

@Siddh2024 ?? can u do this?

yash-pouranik avatar Jul 10 '26 20:07 yash-pouranik

pls assign this to me under gssoc

aaniya22 avatar Jul 12 '26 23:07 aaniya22

@aaniya22 Select and mention the api u want to set limit

Ayush4958 avatar Jul 13 '26 04:07 Ayush4958

@aaniya22 Select and mention the api u want to set limit

yeah so i was thinking of just adding a global limit first using express.json({ limit: '1mb' }) and express.urlencoded({ limit: '1mb', extended: true }) in the main app file, that way it covers all endpoints by default. if any specific route needs a diff limit (like file uploads) i'll handle that separately. will raise a pr once assigned

aaniya22 avatar Jul 13 '26 04:07 aaniya22

Sounds good Let's hear from @yash-pouranik So he could assign u

Ayush4958 avatar Jul 13 '26 04:07 Ayush4958

I think 500KB is enough for all the users. And for file uploads, we use pre signed urls bsclly none of our apis work for file uploads. Storage provider handles the uploads via pre signed URLs. So we can have a global size limitter on all the api with 500KB.

@aaniya22

what say @Ayush4958

yash-pouranik avatar Jul 13 '26 08:07 yash-pouranik

@aaniya22

yash-pouranik avatar Jul 17 '26 07:07 yash-pouranik