Fix: Reduce body limit from 8mb to 1mb and remove duplicate route mounting#131
Open
Xenon010101 wants to merge 2 commits into
Open
Fix: Reduce body limit from 8mb to 1mb and remove duplicate route mounting#131Xenon010101 wants to merge 2 commits into
Xenon010101 wants to merge 2 commits into
Conversation
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>
Author
|
Hi @madanrajsagar, just checking if there's anything blocking this from merging. Happy to make changes if needed. |
Author
|
Hi maintainer! This PR has been open for a while — just a friendly nudge for review when you get a chance. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #70, Closes #126
#70 — Body limit too large (8mb → 1mb)
Root cause:
server.js:19setexpress.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-53hadapp.use(userVideoRoutes)(no prefix) followed byapp.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.