Skip to content

Fix: Reduce body limit from 8mb to 1mb and remove duplicate route mounting#131

Open
Xenon010101 wants to merge 2 commits into
madanrajsagar:mainfrom
Xenon010101:fix/bugs-70-126-server-cleanup
Open

Fix: Reduce body limit from 8mb to 1mb and remove duplicate route mounting#131
Xenon010101 wants to merge 2 commits into
madanrajsagar:mainfrom
Xenon010101:fix/bugs-70-126-server-cleanup

Conversation

@Xenon010101

Copy link
Copy Markdown

Closes #70, Closes #126

#70 — Body limit too large (8mb → 1mb)

Root cause: server.js:19 set express.json({ limit: '8mb' }). Most endpoints need far less; the large limit increased abuse potential.

Fix: Changed to 1mb, which is sufficient for all endpoints. The vehicle observation route with base64 images can be individually increased later if needed.

#126 — Duplicate userVideoRoutes mounting

Root cause: server.js:52-53 had app.use(userVideoRoutes) (no prefix) followed by app.use('/api', userVideoRoutes) — the first mount was redundant.

Fix: Removed the unprefixed app.use(userVideoRoutes) line. Routes remain correctly accessible under /api/save-video, /api/user-videos/:userId, /api/video/:id.

Closes madanrajsagar#129

Added verifyToken middleware to /send-email endpoint so that
emergency SOS emails can only be sent by authenticated users.

Previously anyone could POST to /send-email and trigger emergency
alerts to contacts, enabling spam and alert fatigue attacks.

Signed-off-by: Xenon010101 <xenon010101@users.noreply.github.com>
…nting

Closes madanrajsagar#70, Closes madanrajsagar#126

- Reduced express.json body limit from 8mb to 1mb (8mb was excessive
  for most endpoints and increased abuse potential)
- Removed duplicate app.use(userVideoRoutes) which caused redundant
  middleware execution and potential double-prefixing issues

Signed-off-by: Xenon010101 <xenon010101@users.noreply.github.com>
@Xenon010101

Copy link
Copy Markdown
Author

Hi @madanrajsagar, just checking if there's anything blocking this from merging. Happy to make changes if needed.

@Xenon010101

Copy link
Copy Markdown
Author

Hi maintainer! This PR has been open for a while — just a friendly nudge for review when you get a chance. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] Remove duplicate userVideoRoutes mounting in server.js express.json body limit 8mb is too large

1 participant