Skip to content

Fix: No input validation on incidentId path parameter#132

Open
Xenon010101 wants to merge 3 commits into
madanrajsagar:mainfrom
Xenon010101:fix/bug-62-incidentid-validation
Open

Fix: No input validation on incidentId path parameter#132
Xenon010101 wants to merge 3 commits into
madanrajsagar:mainfrom
Xenon010101:fix/bug-62-incidentid-validation

Conversation

@Xenon010101

Copy link
Copy Markdown

Closes #62

Root cause: req.params.incidentId was used directly in findIncident() 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 Express router.param('incidentId', ...) middleware so all /:incidentId routes reject invalid IDs with a clean 400 response.

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>
@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.

no input validation on incidentId path parameter

1 participant