🔒 Add input validation to post endpoints#68
Conversation
This commit adds input validation for the title, description, contact, industry, education, keywords, and expiration_date fields in both the POST and PATCH endpoints for the post resource. By explicitly checking string lengths, types, and required formats, this change mitigates denial of service (DoS) risks and database inconsistencies caused by extremely large payloads or improperly typed data. Tests were also updated to verify that the API returns a 400 Bad Request error when invalid data is provided. Co-authored-by: Sparkier <5690524+Sparkier@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Resolved Prettier code style issues in `src/routes/api/post/+server.ts`, `src/routes/api/post/[id]/+server.ts`, and `src/routes/api/post/server.test.ts` to fix the CI pipeline. Co-authored-by: Sparkier <5690524+Sparkier@users.noreply.github.com>
🎯 What: The
⚠️ Risk: Without validation, malicious actors could send extremely long strings or invalid data types, potentially causing denial of service, memory exhaustion, or database errors/bloat.
POSTandPATCHendpoints for creating and updating posts lacked input validation.🛡️ Solution: Added explicit checks for field types and string lengths (e.g.
titlemax 255 chars,descriptionmax 5000 chars). It returns an HTTP 400 if validation fails, protecting the database layer from malformed data.PR created automatically by Jules for task 3952108799218630852 started by @Sparkier