Skip to content

feat(api): Implement Zod runtime validation and strict rate limiting #52

Description

@Diwakar-odds

Summary

The Next.js API routes (like /api/issues/feed/route.ts) parse req.json() directly without runtime validation. Furthermore, there is no rate limiting on endpoints that wrap the GitHub API, leaving the system vulnerable to abuse and exhaustion of rate limits.

Motivation

Adding robust Zod runtime validation and an Upstash/Redis rate limiting layer constitutes core backend security hardening and reliability improvements, satisfying L3 security criteria.

Changes Required

  • Integrate zod for request payload validation.
  • Integrate @upstash/ratelimit and @vercel/kv for distributed rate limiting.
  • Refactor the /api/issues/feed POST route to validate the languages and page parameters via Zod.
  • Apply a fixed-window rate limiter to reject excessive requests with 429 status codes.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions