Fix: enforce token authentication, email matching authorization, and … - #234
Merged
Premshaw23 merged 2 commits intoMay 21, 2026
Merged
Conversation
…rate limits on registration endpoint Premshaw23#170
Contributor
|
@omnipotentchaos is attempting to deploy a commit to the Prem Shaw's projects Team on Vercel. A member of the Team first needs to authorize it. |
Premshaw23
approved these changes
May 21, 2026
Owner
|
done👍 |
Contributor
Author
|
hey, @Premshaw23 . |
Owner
sorry for this , i didn't see that I deleted some label globally and my mistake it deleted by your pr also, but dont worry i will fix today and you can see correct updated point tomorrow , if any issue let me know @omnipotentchaos |
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.
What type of PR is this?
Description
This PR resolves critical security vulnerabilities in the registration endpoint (
/api/register). Previously, anyone could call the endpoint to register arbitrary users and upload face images without authorization, posing a high risk for spam accounts, bot abuse, and unauthorized biometric data collection.This change introduces token-based authorization via Firebase, email match validation, sliding-window rate limiting, and Vercel Blob rollback protection on database failures.
Related Issues
Closes #170
Changes Made
app/api/register/route.js. Requests with missing or invalid tokens are rejected with401 Unauthorized.emailsent in the registration form strictly matches the verifiedemailfield inside the Firebase ID token. Mismatches are rejected with403 Forbidden.5 registration attempts per 1-minute windowper IP, protecting the endpoint from automated spam/bot registrations. Exceeded limits yield429 Too Many Requests.del()) from Vercel Blob storage, preventing orphaned files.components/register.jsto dynamically retrieve the authenticated user's ID token (getIdToken()) and supply it in the standardAuthorizationheader.SECURITY.md.components/_tests_/registerRoute.test.jscovering token presence/absence, token validity, email ownership, rate limits, and DB rollback.Testing
How did you test these changes?
Local Test Execution Results:
All 57 unit tests (including the newly integrated security test suite) passed successfully: