Skip to content

fix : added rating range validation and HTML escaping to send-review route - #6

Open
tmdeveloper007 wants to merge 1 commit into
syedahmedkhaderi:mainfrom
tmdeveloper007:rate-review-validation
Open

fix : added rating range validation and HTML escaping to send-review route#6
tmdeveloper007 wants to merge 1 commit into
syedahmedkhaderi:mainfrom
tmdeveloper007:rate-review-validation

Conversation

@tmdeveloper007

Copy link
Copy Markdown

Summary of What Has Been Done:
Added server-side validation to ensure the rating field is an integer between 1 and 5 before the email is generated. Also escaped HTML special characters in name, email, and review fields to prevent accidental HTML injection in email clients.

Changes Made:

  • app/api/send-review/route.js: Added rating range check returning 400 for out-of-range values. Added HTML entity escaping for name, email, and review in the email template.

Impact it Made:

  • Prevents email template crash when rating is out of range
  • Provides defense-in-depth against HTML/script injection in email clients
  • Verified with ESLint: no new errors introduced

Note: Please assign this PR to the tmdeveloper007 account.

- Validate rating is integer between 1 and 5 before email generation
- Escape HTML special characters in name, email, and review fields
- Return 400 response for missing fields and invalid rating
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.

1 participant