Skip to content

fix(saved-materials): validate user and material route params#331

Merged
BHUVANSH855 merged 1 commit into
AnthropicBots:mainfrom
om-dev007:fix/issue-305-validate-saved-material-params
Jul 8, 2026
Merged

fix(saved-materials): validate user and material route params#331
BHUVANSH855 merged 1 commit into
AnthropicBots:mainfrom
om-dev007:fix/issue-305-validate-saved-material-params

Conversation

@om-dev007

Copy link
Copy Markdown
Contributor

Summary

Added route parameter validation for saved materials endpoints to prevent malformed IDs from reaching authorization and database logic.

Changes made

  • Added validation middleware for id and materialId route parameters

  • Enforced positive integer validation for saved materials route params

  • Applied the validator to both:

    • toggle save endpoint
    • get saved materials endpoint
  • Normalized controller param handling to use numeric IDs consistently in authorization and database queries

Benefits

  • Returns 400 Bad Request for malformed route parameters
  • Prevents invalid IDs from reaching the ORM layer
  • Makes error behavior more predictable and improves controller safety

Issue fixed

Closes #305

@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

@om-dev007 is attempting to deploy a commit to the Mohit Yadav's projects Team on Vercel.

A member of the Team first needs to authorize it.

@om-dev007

Copy link
Copy Markdown
Contributor Author

@BHUVANSH855 please review this pr

@BHUVANSH855 BHUVANSH855 added SSoC26 Program label for Social Summer of Code Season 5. Medium Program's points label. labels Jul 8, 2026
@BHUVANSH855 BHUVANSH855 merged commit c3947f0 into AnthropicBots:main Jul 8, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Medium Program's points label. SSoC26 Program label for Social Summer of Code Season 5.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate userId and materialId route parameters in saved materials controller

2 participants