fix: comprehensive validation and security fixes (issues #71, #74, #75, #72, #73, #35)#82
Open
anshul23102 wants to merge 1 commit into
Open
Conversation
…hyaSS#71, AditthyaSS#35): comprehensive validation and security fixes Implements fixes for 6 related validation and security issues: AditthyaSS#75: Add isVerified check to GET /api/models/[slug]. Prevent returning unverified/pending model submissions to the public API. Returns 404 to avoid leaking information about pending submissions. AditthyaSS#74: Remove duplicate offset parameter parsing in GET /api/models that was overwriting validated offset/limit values with unsanitized ones. AditthyaSS#73: Gate feed event creation on isVerified status. Only verified models should appear in the public activity feed. Pending submissions are excluded from feed to prevent leaking unreviewed content. AditthyaSS#72: Add entityId existence validation in POST /api/reviews. Verify that the referenced model or tool actually exists before accepting review submission, preventing database pollution with orphaned reviews. AditthyaSS#71: Add name length constraint validation to POST /api/models. Names must be 1-200 characters to prevent excessively long values that could break UI rendering or storage. AditthyaSS#35: Enhance comment field validation in POST /api/reviews. Trim whitespace and prevent all-whitespace-only submissions. Prevents spam and ensures comment field integrity. Signed-off-by: Anshul Jain <anshul23102@iiitd.ac.in>
|
@anshul23102 is attempting to deploy a commit to the aditthyass' projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
This PR implements comprehensive validation and security fixes across API endpoints to prevent database pollution, information leakage, and input validation bypass attacks.
isVerifiedcheck to GET/api/models/[slug]to prevent exposing unverified/pending model submissionsisVerifiedstatus to keep pending submissions out of public feedsChanges
GET /api/models/[slug] (fixes #75)
isVerifiedcheck after model fetchGET /api/models (fixes #74)
POST /api/models (fixes #71, #73)
isVerified === truePOST /api/reviews (fixes #72, #35)
Test Plan
/api/models/[slug]returns 404 for unverified models/api/modelspagination uses validated offset/limit/api/modelsname length validation (rejects < 1 or > 200 chars)/api/reviewsrejects non-existent entityIds with 404🤖 Generated with Claude Code