Fix: No input validation on incidentId path parameter#132
Open
Xenon010101 wants to merge 3 commits into
Open
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>
Closes madanrajsagar#62 Added isValidIncidentId check (non-empty string, max 64 chars) with Express router.param middleware so all /:incidentId routes reject malformed IDs with a clean 400 response instead of processing them. 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 #62
Root cause:
req.params.incidentIdwas used directly infindIncident()with no format validation. While a missing incident returned 404, malformed or excessively long IDs were still processed.Fix: Added
isValidIncidentId()check (non-empty string, max 64 chars) with Expressrouter.param('incidentId', ...)middleware so all/:incidentIdroutes reject invalid IDs with a clean 400 response.